When I try to ssh, the password prompt takes too long (almost two minutes) to appear.
Why does this happen?
|
When I try to Why does this happen? |
|||||
|
|
There are several things that can go wrong. Add The problem could be on the client or on the server. A common problem on the server is if you're connecting from a client for which reverse DNS lookups time out. (A “reverse DNS lookup” means getting back from the client machine's IP address to a host name. It isn't really useful for security, only slightly helpful to diagnose breakin attempts from log entries, but the default configuration does it anyway.) To turn off reverse DNS lookups, add Another thing that can go wrong is GSSAPI authentication timing out. If you don't know what that is, you're probably not relying on it; you can turn it off by adding the line |
|||||||||||||||||||||
|
|
Let time the login process and see how long it will take:
See above it took about 45 seconds to login -------- VERY SLOW Once You login as root edit sshd_config file and change the UseDNS entry as below. Here I am using sed instead of editing the file.
Let us time the login process and see now how long it will takes.
See it took now 6 seconds, the time for me to type the password. |
|||||||||||||
|
|
It is something that comes wrong from Ubuntu's installation. To fix it you have to change this line in /etc/nsswitch.conf:
And change it for this one:
|
|||||||||||||||||
|
|
In my case, the issue can be solved by restarting
This is mentioned on Serverfault. I have to do this regularly though, and I don’t know what the root cause of the problem is. |
||||
|
|
|
The debug output for ssh in my case just stopped for 30 seconds while it was 'connecting'. The solution turned out to be related to the DNS settings on my local system. A previous network configuration had left behind a bogus DNS server in the |
|||
|
|
|
For me was changing system dns to 127.0.0.1, prior to this is was a non-existing host.
And write the following
|
|||||
|
|
I don't know as much about the poster's environment as I'd like to, but for others with a similar problem, it may be an issue with This happens to me:
I have to gain access to the server (in my case via the console) then do a:
After that, things just work. I haven't had time to debug the root cause, but this bandaid works for me. |
|||
|
|
|
I could solve the slow password prompt via ssh - issue by checking Enable DNS Relay in DHCP settings on my dlink router. Afterwards connections with SSH worked within a second.
The default configuration forwards every DNS request to the provider. It was slow although I was connecting with ssh pi@10.0.0.103. A hint to the solution was an entry in /etc/resolv.conf "search upc.at" which is provided via dhcp. The dlink manual states:
After a dhcp release on client and server, connecting via SSH was fast again. HTH. |
||||
|
|
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?