In recent weeks, login times on my Ubuntu server have started timing out; both through SSH and the local command line console. Examination of the /var/log/auth.log
files yields nothing interesting.
How can I diagnose long log in times on my Ubuntu server?
I should mention, also, that no updates have been performed since the problem has started, and that the /
, /boot/
and /usr/
file systems are mounted as readonly.
[Edit] This is a stand alone machine, so it doesn't authenticate with Active Directory, LDAP etc. Also, the login prompt is responsive, as is the password prompt. Upon typing the password then CR, I'll timeout. After four a five tries, I will be able to login, although I'm worried this will start taking longer.
Quite often this is due to a reverse DNS lookup of your host IP.
Make sure your client IP has a reverse IP DNS record.
See this link for more details of a work around if setting up reverse records is out of your sphere of influence.
Take a look at the UseDNS [yes|no] in the sshd_config file. If it is set to Yes there is a good chance that a delay will/can occur. Take a look here: OpenSSH FAQ especially chapter 3.3. It also points to some other possible delay causes.
This thread is old but I felt onto it seeking for answers. I give my solution here. My problem (took about 1 minutes to ssh login into my raspberry pi), was due to a corrupted .bash_history file. Since the file is read at login, this was causing the login delay. Once I removed the file, login time went back to normal, like instantaneous.
Hope this will help some other people.
Cheers
Perhaps your
/bin/login
has been replaced by an evil twin that ships your passwords offsite. If such a program is poorly written, it could be hanging and/or timing out.Perhaps your user's (or system-wide) shell profile/rc is running something slow
Are logins also slow in single user (runlevel 1) mode? Are you in runlevel 5? if so, try going to runlevel 3 (if you can) and see if there's a change in login speed.
Do you have nscd running (
pidof nscd
)? If so, shut it down and see if it gets better. If it does get better, dorm /var/db/nscd/*
and start it back up.Most of the answers on SO and elsewhere suggested the problem was a DNS issue. On a Debian system with a very long uptime, I saw it stalled out on talking to a dbus socket (logs shown below). Turns out, restarting dbus
systemctl restart dbus
fixed the problem