This happened for the first time three days ago - I ssh to the server, authenticate using a password, get the welcome message but it remains hanging on the "Last login:..." line. The command line doesn't show and the server doesn't react to my input. Other services on the server keep working ok (apache, tomcat, database, ..). The box has an out-of-band management using which I was able to restart it. After the restart the ssh worked ok again and I didn't find anything suspicious in the logs. Three days later the same problem occurs on this box again, and newly on yet another server in the cluster - 100% same symptoms.

Both servers have about 2 month old installation of Debian Squeeze (6.0.2) and the problem never occurred before despite frequent ssh-ing, so it should not be a problem of settings. We haven't been installing anything new for quite some time now. I also made sure there is enough disk space on both servers. Since it started to happen all of a sudden on two servers at about the same time, I suspect some bug may have been introduced via Debian updates, yet I haven't been able to find anyone with the same problem.

Most similar issues I have found:

ssh freezes at the "Last Login Line" - in our case everything worked fine until recently, so nothing related to settings should be our problem. Diskspace checked, I couldn't check the memory but I would expect something would be in the logs if the system had been running out of it.

Remote Fedora system unresponsive, odd but consistent behavior when trying to log in - problem with high load on the server; unlike in this case, nothing changes even if I wait for 10+ minutes

  • sorry for misplacing (had seen some related questions on SO and didn't think twice). Thank you guys for migrating my question. – Pavel H Oct 3 '11 at 11:40
  • What about 'ssh -T' or 'ssh myhost bash -i'? Do one or both work? Is it a Dell system? – user119058 Apr 27 '12 at 20:59
  • I have the same issue with an Arch machine. Started happening about 3 months ago. Not sure the cause. Eventually SSH crashed or otherwise stopped listening on it's port. ssh -t vim and other commands would work, but as soon as you tried a login shell it would hang. Other web services working fine. It is hooked up to my TV and once so far I've noticed that Kodi in XFCE is also hanging for a different user. – Nick Apr 8 '19 at 19:55
  • @Nick were either of you able to figure out a resolution to this problem? – BurntSushi5 Apr 30 '20 at 16:15

Login using ssh -vvv and see what debug info shows up. This is odd in that the last login line is usually after the ssh session is setup. Also check your /var/log/{messages,auth,daemon} and whatever else is relevant.

Are your drives full? Is something unexpected going on with configuration? I know you didn't change it, but maybe something was compromised?

  • Hi Jeff, ssh debug info looks ok (same as when I ssh to a working system), it ends up with debug2: shell request accepted on channel 0, then the welcome lines show and it gets stuck. Nothing in messages.log and daemon.log. auth.log says session opened for user... (and then session closed.. - probably as I closed the terminal on my computer). I also suspect the problem may not be in ssh itself - it seems to have completed its job and the problem happens afterwords. – Pavel H Oct 3 '11 at 12:52
  • ...and I did check the diskspace - no prob there, and there has not been any change in the configuration recently – Pavel H Oct 3 '11 at 12:58
  • I wager your SSH config is just fine and something is going on in your login scripts -- probably a process that is hanging. – Jeff Ferland Oct 3 '11 at 13:23
  • 1
    In desperation, I'd attempt ssh -t screen, ssh -t bash, or even ssh -t vim... if one of those works, you can run commands from it. Vim might be the best bet because it won't spawn a shell at the start, so that may avoid login shell issues and you can spawn a non-login shell from it. – Jeff Ferland Oct 3 '11 at 17:05
  • 1
    More desperate! ssh root@machine /sbin/ifconfig eth0 mtu 1000 (God help you if you can't root login directly, you might have to write a program to do the sudo operation for you). From bugs.debian.org/cgi-bin/bugreport.cgi?bug=296811 – Jeff Ferland Oct 3 '11 at 18:04

If the hang disappears after say 1 minute to two minutes, you probably have an unreachable DNS server problem.

If it is not that, consider using ServerAliveInterval, KeepAlive yes and ClientAliveInterval (e.g. 60)

  • Hi, no, the hang doesn't disappear - waited for more than 10 minutes. Once it happens, the only way to be able to ssh in again is to restart the server via DRAC. – Pavel H Oct 3 '11 at 11:39

You have something unexpected in your configuration. Home directories under nfs/samba/something else? Something executing at your .bashrc or other startup files?

  • Hi Janne, nothing I know of. Home directories are local to the servers. I checked /etc/bash.bashrc, /etc/profile (nothing in profile.d) and ~/.bashrc - no fancy stuff in any of them, just setting the environment (prompt, autocomplete etc) - guess it is just default stuff. Is there anything else I could check? – Pavel H Oct 3 '11 at 16:49

This just happened to me. In my case it turned out that a recent change to my .bashrc file was causing an infinite loop (.bashrc was sourcing .bash_profile which was sourcing .bashrc, doh!) After the last login line was displayed I was able to Ctrl+c and get to a prompt and correct my mistake.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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