0

we have a Centos server and currently SSH access to it isn't working. It used to work until some 5 days ago. Now, the only way to log into the machine is to do it locally. We have tried SSH both using Putty and FileZilla with no success. The machine is alive and answering. I can ping it and the Apache service is up and running. But SSH access isn't available. When I try it using Putty, the machine answers asking me to type the username. I do it. When it asks me for the password, it never answers again and, after some 60 seconds, it times out... Any ideas where we should work to try to sove this problem? Thank you in advance!

Marcos Buarque
  • 101
  • 1
  • 3
  • I'd follow the troubleshooting guide on the following link: http://docstore.mik.ua/orelly/networking_2ndEd/ssh/ch12_01.htm – milosgajdos May 08 '12 at 15:36
  • Besides the questions asked by @johnshen64: check log files `/var/log/messages` and `/var/log/secure`. What kind of authentication do you use? local accounts, LDAP, etc.? – Bram May 08 '12 at 15:38

3 Answers3

1

I have seen cases where SSH logins could hang due to mis-configured DNS servers in /etc/resolv.conf. Especially if sshd is using DNS for reverse lookups or logging. Check your DNS configuration on the server and verify you can ping and resolve external names like google.com.

Andy Shinn
  • 4,211
  • 8
  • 40
  • 55
  • The access to this server specifically has always been done through its IP address. So I think the issue probably doesn't have to do with DNS. – Marcos Buarque May 08 '12 at 15:39
  • This seems like the symptoms of what you described. We had similar issues (although it was only about 30 seconds and it would eventually connect). Try changing UseDNS to No in the `/etc/ssh/sshd_config` file to completely bypass this step. And as the other two mentioned, the best way to troubleshoot is look in the logs (get into the server via the console and do `ls -ltr /var/log` right after the attempt. This will sort the logs by most recently modified. Look at which logs were touched and see if they have any pertinent information. Good luck. – Safado May 08 '12 at 15:40
  • @Marcos - The SSHD will do a *reverse* lookup on the IP address. – Safado May 08 '12 at 15:41
  • Hey, friends, thank you all. We will try all the items suggested in the posts from you all when the server administrator actually "sits" on the machine to try the fixes suggested. Thank you again and again. – Marcos Buarque May 08 '12 at 16:13
0

It never answers?

Is it running at all? Check:

ps aux| grep sshd

Or does it accept a connection but the login doesn't go through?

Did you try typing in the password and pressing the Enter key? SSH clients usually dont write-out stars or dots like webbrowsers do.

Can you also try SSH debug mode? Try connecting from another linux box with:

ssh -vvv user@your.cent.os.ip

and check the output for any problems.

Also try sshing from the box itself ("ssh localhost"), and see if that works. You might have a network (or firewall) problem if this works, and remote ssh doesnt.

mulaz
  • 10,682
  • 1
  • 31
  • 37
0

First of all you should check the logs on that server: /var/log/auth.log or similar (I don't know where sshd logs on CentOS). If the server refused the connection, the log should tell you why.

Oliver
  • 5,973
  • 24
  • 33