SSHd Slow Password Prompt
Was experiencing slow password prompts when initiating SSH connections. Discovered an entry in /etc/hosts that caused it to act funny.
I was experiencing slow password prompts on Ubuntu 11.10 running OpenSSH_5.8p1. A quick Google search revealed that the issue is usually DNS related.
I took the following troubleshooting steps:
Edit /etc/ssh/sshd_config to add “UseDNS no” (reports showed “UseDNS yes” should already be present in file, but wasn't?)
Restarted SSHd using “service ssh restart”.
Attempted to initiated a new SSH session: Connection refused
Removed UseDNS entry. I had seen some information about PAM causing slow auth, so I changed “UsePAM yes” to “UsePAM no”.
Attemped to initiate a new SSH session, was able to login quickly. I wasn't happy with having PAM off, so I turned it back on.
Restarted SSHd, attempted to login again. Login was slow.
I had seen something mentioned that if the server hostname in /etc/hosts didn't match up that that could cause an issue.
I cat-ed /etc/hosts and saw a hosts entry I had added around the time the password prompt started acting up.
I removed the entry in /etc/hosts (no long necessary). I restarted SSHd just to be safe and password prompts were fast again.
No idea why. Will update if issue comes back.