1

Possible Duplicate:
ssh delay when connecting

Whenever I try to SSH into my CentOS server from my desktop, after entering "ssh user@address", it hangs with a flashing cursor for about 30 seconds before asking for a password. Once connected it's fine, and it's instant on other devices.

Any idea what could cause this? I have already cleared out ~/.ssh.

Torvero
  • 414
  • 7
  • 14

2 Answers2

5

I will bet dollars to donuts that the problem here is with your DNS configuration on your server. SSH tries to reverse-look up your hostname, and if that's slow, you'll get a delay. (Often, the problem is with the first server in your /etc/resolv.conf, but it could also be something wrong with your client system's DNS configuration.

mattdm
  • 6,600
  • 1
  • 26
  • 48
  • I'm going to look at what ewwhite said, if it helps both my server and my desktop use Google's DNS, 8.8.8.8. – Torvero Dec 01 '12 at 17:08
  • 1
    Had exactly this on with SSL connections to our ejabberd server. Added the reverse entry to the /etc/hosts file on the server and the problem went away. – Colin 't Hart Jan 15 '19 at 13:03
0

This is probably a DNS issue. Can you check that the DNS on your CentOS server is configured properly?

If you don't have full access to your DNS setup, you can add an entry in /etc/hosts for the IP you're connecting from. That will most-likely shorten the delay.

Also see: 10 second SSH delay prior to successful login and ssh delay when connecting

ewwhite
  • 197,159
  • 92
  • 443
  • 809
  • Thanks, I'll check now and get back to you. Not sure though if that could be it as it is instant on other devices on the same network. Edit: could it be anything to do with my server and desktop using Google's DNS (8.8.8.8)? I'm quite new to this I guess. – Torvero Dec 01 '12 at 17:04