Take the tour ×

There are a lot of questions about SSH connections being delayed, which usually can be fixed by disabling the DNS lookups. Unfortunately this doesn't seem to be my problem.

Our development server is accessed via SSH and Samba. When opening a connection to the server (either SSH or Samba) it takes a very long time. Accessing a Samba share via Windows is basically impossible because there is a timeout. Using smbclient works, but takes ages. When opening a SSH connection I get immediately prompted for the password and after hitting Enter the terminal instantly shows the MOTD. Afterwards it takes about a minute for the prompt to appear.

I watched the load of the server while connecting via SSH and Samba and could not find anything out of order. There is nothing out of the ordinary running and hogging up memory and CPU or something. I have no clue where this delay might come from. I already tried UseDNS no in sshd_config and proxy_dns = no in smb.conf, but to no avail.

Any idea about what might cause this would be greatly appreciated!

Update: I'm sorry to say so, but I have been away for some weeks now and in the meantime the servers in question have been replaced by other newer systems which so far didn't present the same problems. Unfortunately this leaves me with no possibility to check any of the suggestions made here, but I'm grateful for your help nonetheless!

share|improve this question
Is it slow even if there is an existing connection? –  benjarrell Oct 25 '12 at 21:19
@benjarrell No, it's only delayed when I open up a connection. Once the connection is up, there are no more problems. But as I wrote...with Samba the delay causes Windows to do a premature timeout and thus it's not usable at all. –  Till Helge Oct 26 '12 at 7:47
What is done after client startup? ...in /etc/profile, ~/.profile, ~/.bashrc etc.? Is't there some operation requiring DNS resolving? IMHO is the problem DNS related –  Kamil Šrot Nov 2 '12 at 18:02
i agree with Kamil, most likely a DNS problem - you can test this (and hopefully correct it) by entering your local addresses with hostnames in your server's /etc/hosts file to "short circuit" the dns resolution - one per line eg Bob –  user16081 Nov 7 '12 at 7:23
add comment

closed as too localized by Iain Dec 18 '12 at 13:31


2 Answers

Maybe its a problem related to the entropy in the system. Headless servers lack from inputs to generate enough random and sometimes it delays ssh connections.

Check the number in /proc/sys/kernel/random/entropy_avail often and if its almost always below 150-200 try to install any like haveged or rng-tools

share|improve this answer
add comment

It is possible you have a disk problem. Check out the wa (iowait) stats in top, or install iotop, and/or check your disks in the normal way.

To get some sensible debugging info out of sshd, simply set the Loglevel to something like DEGUG2 in /etc/ssh/sshd_config and then tail -f /var/log/auth.log to see what is happening on a client connection.

share|improve this answer
add comment
