Tuesday, November 08, 2011

Slow SSH and sudo Login (Ubuntu)

I have been annoyed by extremely slow SSH logins to an Ubuntu VM of mine for a while now. Both the login and password prompt displayed quickly enough and there was no delay in keyboard input, however after submitting my password I'd be faced with a delay of somewhere between 10 and 30 seconds. I had begun noticing similar delays when using sudo to switch to root (though these delays weren't quite as long).

My threshold of annoyance was finally crossed this evening and I decided I'd better figure out why this was occurring. Most resources I found online seemed to point in the direction of ensuring "UseDNS no" has been set in /etc/ssh/sshd_config, unfortunately this was not the problem in my case.

After digging around a bit longer, I bumped into a helpful thread on the Ubuntu forums that pointed out the actual problem was likely with PAM.

Making the recommended change by commenting out the following PAM connector in /etc/pam.d/common-session did the trick.

# session       optional                        pam_ck_connector.so nox11

3 comments:

Anonymous said...

Thanks for this. I had the exact same problem, with UseDNS already set to no.

Chris said...

Glad to hear it helped. Also comforting to know I'm not the only person in the universe who runs into some of these things. ;)

Anonymous said...

Thank you!!!!! Its work!!!
I crashing my head a lot of time to try fix this issue!!