{ 12 comments… read them below or add one }

1 Narendra July 16, 2010 at 2:12 am

This will work if you are doing ssh from a Linux machine.
What if you are doing ssh from a Windows machine?

2 Kuric July 16, 2010 at 6:40 am

you can download the free secureshell SSH client from the link below or google for
SSHSecureShellClient-3.2.9.exe

http://charlotte.at.northwestern.edu/bef/SSH/SSHSecureShellClient-3.2.9.exe

This is a command line windows SSH client, been working fine for a long time..

Hope this helps…

-Mike

3 Brad July 16, 2010 at 7:16 am

@Narendra, even though you may not be able to use the Debug option in your Windows client, changing the UseDNS setting on your target machine will still resolve the slow SSH problem. If that is indeed the problem We have started to disable that on all our SSH servers as a standard practice.

4 Geoff July 16, 2010 at 9:04 am

Great tip – using putty on a windows machine, but changed the option on the linux server (as you said) and it worked like a charm.
Thanks much!

5 Jeremy July 16, 2010 at 11:17 am

Cool tip.
By the way, If I remember correctly, the length of time of the delay correlates with how many resolvers you have listed in /etc/resolv.conf.
You could also just add an entry in the /etc/hosts file of the remote host for your client machine (if it is predictable). It could be as simple as:
1.1.1.1 me
…of course, the address must match your client host.
Or, you could add a reverse-dns (ptr) record for your client machine to the DNS server that your remote host uses (if you have control over it, and other mitigating conditions).
:)

6 Narendra July 18, 2010 at 11:50 pm

Mike / Brad,

Thanks for the suggestions.
I am using putty from my windows machine to login to ssh server.

Regards,
Narendra

7 Dennis January 6, 2012 at 11:35 am

Thanks, worked for me!

8 Anonymous April 27, 2012 at 11:38 pm

Tanx :) worked for me gooood ;)

9 Tzach June 26, 2013 at 6:01 am

Thanks A lot :)

10 PM June 27, 2013 at 11:09 am

Thanks a lot!

11 Grisa October 25, 2013 at 11:34 am

Another thing to try BEFORE you do any of the above is verify what your MTU settings on your NIC…..

12 Yale Chubb June 3, 2014 at 6:05 pm

This advice is a bit like going to the doctor with a pain in the leg and the doctor advices that the easy way to stop the pain in the leg is to amputate it.

Yes setting UseDNS to no in the sshd_config file on the *remote* machine will cure the symptom but it will not cure the underlying problem that DNS lookups on the remote machine are not working as they should, the most likely reason being that your local machine does not have a DNS record. And if your machine does not have a DNS record either on the internal network or on the Internet, then the DNS service is not being managed effectively, so why even bother with it for local/internal network.

And people who are still using passwords with ssh rather than passphrases and key files, obviously do not know how to use ssh in its most secure mode in the first place, so failing to chastise the questioner on that point in the response demonstrates how much security is being taken seriously in this “fixing” of the problem.

Jeremy’s answer was the CORRECT way to FIX this problem.

Leave a Comment

Previous post:

Next post: