Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
ssh delay when connecting

We have a CentOS server that we use for internal testing purposes, which has sshd enabled. When I (as a developer) am at the company, I use ssh root@ to connect to it - and it works flawlessly.

Now, in order to work from home, accessing the server via the company's static IP, we set up another port for ssh, 2020. So I execute ssh -p 2020 and am immediately granted for a password. After entering the password, it takes up to 30 seconds until I can access the server. Same is with SFTP (i.e. uploading files takes about 30 seconds until it begins to transfer). As you can imagine, if you have to regularly upload files to a webserver via SFTP, this is very tedious.

So I looked at similar questions and thus edited the sshd_config file on the server, setting UseDNS to "no" and GSSAPIAuthentication to "no" (this one also in ssh_config on the client) - it did not work..

Please have a look at the -vvv output when externally accessing the server: ssh -p 2020 -vvv

PasteBin: ssh

What could it be? Do you need more info?

share|improve this question

marked as duplicate by Iain Sep 27 '12 at 8:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Usually usedns is the reason for the delay, but moduli ( can also contribute to the delay. did you restart the sshd server after making changes to ssh_config? – Hex Sep 27 '12 at 8:28
Nope, how can I actually restart it? Looked for it in the man pages, but couldn't find it. I will look into moduli, thanks. – wnstnsmth Sep 27 '12 at 8:30
Is your server loaded when you are accessing it from home? – Khaled Sep 27 '12 at 8:30
No, there are no more than, say, 2 people accessing at the same time, so that shouldn't be the issue – wnstnsmth Sep 27 '12 at 8:30
So at what line of the debugging output does it pause, exactly? Have you also tried specifying -u0 to the OpenSSHd command line to disable DNS lookups? – the-wabbit Sep 27 '12 at 8:31
up vote 5 down vote accepted

Edited for followup:

Setting UseDNS to NO in sshd_config and restarting the sshd server fixes this issue.

share|improve this answer
Restarted the server with /sbin/service sshd restart on CentOS – wnstnsmth Sep 27 '12 at 9:01
Same problem. However, for me UseDNS yes was commented. ie #UseDNS yes. I thought it was ok. Until I figured it was probably default setting. So I corrected by uncommenting and explicitly setting UseDNS No – fizzy drink Mar 14 '15 at 16:33

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