0

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@192.168.55.131 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 root@xx.xxx.xxx.xx 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 root@xx.xxx.xxx.xx

PasteBin: ssh

What could it be? Do you need more info?

grssnbchr
  • 157
  • 2
  • 8
  • 1
    Usually usedns is the reason for the delay, but moduli (http://www.openssh.com/faq.html#3.3) can also contribute to the delay. did you restart the sshd server after making changes to ssh_config? – Hex Sep 27 '12 at 08: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. – grssnbchr Sep 27 '12 at 08:30
  • Is your server loaded when you are accessing it from home? – Khaled Sep 27 '12 at 08:30
  • No, there are no more than, say, 2 people accessing at the same time, so that shouldn't be the issue – grssnbchr Sep 27 '12 at 08: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 08:31
  • Line 106 and line 112. I will try that as well, thanks. – grssnbchr Sep 27 '12 at 08:33
  • SORRY GUYS, restarting the server solved the problem. I gave up to early, should have googled for "sshd restart"... haha. Thanks for the hint, @Hex – grssnbchr Sep 27 '12 at 08:35

1 Answers1

9

Edited for followup:

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

Hex
  • 1,949
  • 11
  • 17
  • Restarted the server with `/sbin/service sshd restart` on CentOS – grssnbchr Sep 27 '12 at 09: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