When managing Ubuntu 9.04 servers, many administrators notice significant SSH login delays. The primary culprits are often:
- ConsoleKit's message of the day (motd) updates
- Landscape-sysinfo daemon collecting system statistics
First, verify these services are running:
ps aux | grep -E 'console-kit-daemon|landscape'
You should see output similar to:
root 1234 0.0 0.1 1234 567 ? Ss Jan01 0:00 /usr/sbin/console-kit-daemon
root 5678 0.5 0.3 7890 1234 ? S Jan01 0:12 /usr/bin/landscape-sysinfo
To permanently disable the landscape-sysinfo daemon:
sudo update-rc.d -f landscape-sysinfo remove
sudo service landscape-sysinfo stop
For Ubuntu 9.04 specifically, you may also need to:
sudo chmod -x /etc/update-motd.d/*landscape*
For ConsoleKit, we have multiple approaches:
Method 1: Disable the service
sudo mv /etc/init.d/console-kit-daemon /etc/init.d/console-kit-daemon.disabled
sudo update-rc.d console-kit-daemon remove
Method 2: Modify PAM configuration
Edit /etc/pam.d/sshd and comment out any lines referencing pam_console or pam_ck_connector.
Consider these additional optimizations:
# Disable DNS resolution for SSH
echo "UseDNS no" | sudo tee -a /etc/ssh/sshd_config
# Reduce login grace time
echo "LoginGraceTime 30s" | sudo tee -a /etc/ssh/sshd_config
# Restart SSH service
sudo service ssh restart
After implementing these changes:
- Monitor CPU usage during login with:
top -b -n 1 | grep sshd - Check login times:
time ssh localhost exit
You should see significant improvements in both CPU usage and login speed.
On Ubuntu 9.04 servers, many administrators notice significant delays during SSH authentication. When monitoring with top, you'll observe sshd process hitting 100% CPU utilization during login attempts. The primary culprits are typically:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1234 root 20 0 100m 20m 4000 R 100 1.0 0:05.67 sshd 5678 root 20 0 120m 25m 5000 S 45 1.2 0:03.21 console-kit-dae 9012 landscape 20 0 150m 30m 6000 S 30 1.5 0:02.45 landscape-sysin
The landscape client provides system monitoring but consumes resources during login. To disable:
# Stop the running service sudo /etc/init.d/landscape-client stop # Prevent automatic startup sudo update-rc.d -f landscape-client remove # Alternative method for newer systems sudo systemctl disable landscape-client sudo systemctl stop landscape-client
ConsoleKit (console-kit-daemon) is a legacy session management service that's often unnecessary for headless servers:
# Check if running ps aux | grep console-kit-daemon # Disable the service sudo mv /etc/init.d/console-kit-daemon /etc/init.d/console-kit-daemon.disabled sudo update-rc.d console-kit-daemon remove
The Message of the Day (MOTD) system gathers dynamic information during login:
# Disable dynamic MOTD components sudo chmod -x /etc/update-motd.d/* # Create empty MOTD file sudo echo "" > /etc/motd # Alternative: Disable PAM MOTD module sudo sed -i 's/^session.*pam_motd.*$//g' /etc/pam.d/sshd
After implementing these changes, test login performance:
# Time SSH connections before and after time ssh user@server.example.com true # Check active processes during login ssh user@server.example.com "ps aux --sort=-%cpu | head -n 5"
For further optimization:
- Disable DNS lookups in
sshd_config:UseDNS no - Reduce login grace time:
LoginGraceTime 30s - Disable unused PAM modules like
pam_lastlog