Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The other day I tried to connect to my remote server via SSH as i always have. But now when I try to connect it just times out after about 60 seconds. I run

service ssh start

Which tells me that Job is already running: ssh. I then ran

$netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      1972/dovecot        
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      1972/dovecot        
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      2030/mysqld         
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      1972/dovecot        
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      1972/dovecot        
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN      2157/perl           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3028/sshd           
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      2273/master         
tcp6       0      0 :::80                   :::*                    LISTEN      2618/apache2        
tcp6       0      0 :::21                   :::*                    LISTEN      2291/proftpd: (acce 
tcp6       0      0 :::22                   :::*                    LISTEN      3028/sshd 

I am able to access subdomains on my site, and FTP, but don't have the ability to SSH or even ping remotely. Any thoughts?

share|improve this question
    
Did you check your local firewall rules? –  Silviu May 9 '12 at 13:49
1  
Did you check your log for messages related to sshd? /var/log/auth.log, /var/log/secure or something similar... –  Oliver May 9 '12 at 13:51
    
I ran cat /var/log/aut.log | grep sshd and got the following –  dan May 9 '12 at 14:20
    
It doesn't mention any connection attempt from a remote machine. This could be a firewall or iptables issue. –  Oliver May 9 '12 at 14:33
    
its a relatively fresh install of ubuntu, I don't have iptables installed (yet). Is there something else that could be blocking it? Or should i install iptables to allow access to sshd? –  dan May 9 '12 at 14:38

1 Answer 1

Some ideas:

  • To exclude a problem at your end (not on the server), run ssh with the -v argument to see what is going on.
  • telnet <server-ip> 22 will tell you if your connection reaches the server. It should respond with something like SSH-2.0-OpenSSH....
  • Check the server's log files (e.g. /var/log/auth.log, /var/log/secure) for any sshd-related messages. You should see connection attempts from your remote IP address if the connection reaches the server.
  • If your connection cannot reach your server's ssh port, this could have different reasons:
    • Routing problem (in this case, connections to other ports should no go through, too.)
    • External firewall blocking the connection.
    • Local firewall (iptables) blocking the connection. Check with iptables -L if you have any rules installed.
    • If you have denyhosts or fail2ban installed, then your IP is maybe blacklisted. Check your /etc/hosts.deny and the related log file.
share|improve this answer
    
Thanks for all of the ideas this is what i came up with. ssh -v tells me the Operation timed out. Telnet has done the same thing also saying 'Unable to connect to remote host'. /var/log/auth.log does not give me any information about remote connections (i have no /var/log/secure). iptables, denyhosts, fail2ban aren't installed. /etc/hosts.deny is all commented out. Maybe its time to learn wireshark? –  dan May 9 '12 at 15:16
    
Just to make sure: You checked the log file on the server, didn't you? –  Oliver May 9 '12 at 15:17
    
Yes, the only thing i saw wast the pam_unix cron job in auth.log. There is no /var/log/secure on my filesystem. –  dan May 9 '12 at 15:26
    
If you suspect that your IP address might be temporarily blacklisted (by whatever mechanism), you could try to connect from a different IP address. –  Oliver May 9 '12 at 15:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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