Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I'm ssh'd into my server, any time I enter my password, there's a 40 second delay before the server responds.

This occurs when logging in, as well as whenever I run a command via sudo. The delay does not happen when I run su and enter my password however.

Using the -v flag for ssh doesn't show anything during this time. Looking at Wireshark, all traffic between the two machines stops while this is happening.

Any idea what's happening, or advice on how to investigate this?

The server is running Debian squeeze (6.0.4)

Edit: contents of /etc/nsswitch.conf

passwd:        compat
group:         compat
shadow:        compat

hosts:         files dns
networks:      files

protocols:     db files
services:      db files
ethers:        db files
rpc:           db files

netgroup:      nis

Edit 2: result of mount

/dev/simfs on / type simfs (rw,relatime,usrquota,grpquota)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime)
share|improve this question
    
Have you tried looking at the server? –  Ignacio Vazquez-Abrams Jul 10 '12 at 1:52
    
What authentication backend is used on the server? –  Paul Jul 10 '12 at 2:03
    
@IgnacioVazquez-Abrams It's a VPS, so I don't have physical access to it if that's what you mean. Any clues would have to be gathered over ssh. As for looking on the server over ssh, I don't really know where to start. –  Dean Jul 10 '12 at 2:35
    
@Paul I don't know anything about authentication backends past what a few minutes of Googling yielded. I see that I have directories for pam and ldap under /etc. Does that tell you anything useful? –  Dean Jul 10 '12 at 2:38
1  
Well it is possible that you are using ldap for auth in the backend, but it is failing and falling back to /etc/passwd auth. If you could edit and post your /etc/nsswitch.conf it would answer this. –  Paul Jul 10 '12 at 3:10
show 8 more comments

1 Answer

There might be an explanation that doesn't relate to nsswitch.conf, your passwd auth engine etc.

If "su - " is slow but "su" is not, or "sudo" is loading something (like a .bashrc) then it could be that there's something in your profile/rc environment that is causing the slowdown. I've seen this behavior on systems where you connect in and for some reason your profile, or your login/ssh daemon, feels the urge to do a DNS lookup of some sort (eg reverse lookup the source IP) and it sits there like a lemon for 40 seconds.

Just a thought.

share|improve this answer
    
su - is instant, and I tried removing my .bashrc, .profile, etc. files with no luck. I'll look deeper into the rest of the login process when I have a free moment. Maybe I'll try creating a new user to narrow down the scope. –  Dean Jul 18 '12 at 22:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.