5

I have access to a Ubuntu Server (10.4) that I can't SSH into. From a terminal the connection times out and from putty the connection is refused.

I have checked that sshd is running and listening on all interfaces, iptables has all chains empty and default is ACCEPT, additional firewall is accepting on port 22 inbound, and all outbound. I can't telnet into port 22 either.

What could the problem be and how can I troubleshoot it?

  • 1
    So the SSHD runs, listens to port 22, the firewall allows SSHD to be accessed from remotely. How about your client system and you own network; does that allow you to go out ? have you tried the logging options in putty ? have you been in that server before from where you want to access it at the moment ? – Richard Jun 7 '12 at 4:04
  • I can ssh from my current network, just not into this server. Putty log just tells me that the connection is refused. I've never been able to ssh into this server from anywhere. – Charissa Jun 7 '12 at 4:44
6

Try logging in to the console then:

ssh localhost

That will test the ssh daemon on the host without regard to the firewall or other filtering.

  • When I run that I get "Host key verification failed." I'm fairly sure that I have SSH set up for password authentication though. – Charissa Jun 7 '12 at 6:28
  • ssh-keygen -R localhost, then try again – dmourati Jun 7 '12 at 8:19
3

Are you running the server or is someone else? Do you have root access on the server? It sounds like you may be blocked on the server end. Not much you can do from the client side. First thing is to try using the '-v', '-vv', or '-vvv' options to get some debug info about what's going on:

ssh -vv server.name.org

If that's unhelpful you can do a traceroute, ping, nmap on the host to try and see if you can see the machine on the network:

traceroute server.name.org
ping server.name.org
nmap -v -A server.name.org

It's likely you're being blocked by the firewall on server.name.org and not fixable on the client side.

Do you have access to server? If so, you can eliminate the firewall as a potential problem on the server by disabling it, trying to ssh, and then re-enabling it (all from the server):

sudo servce iptables stop; ssh -v localhost; sudo service iptables start

Are you sure the sshd process is running? Try looking to see if it's running:

sudo service sshd status

If it's not running you need to start it:

sudo service sshd start

You can enable it permanently with:

sudo chkconfig sshd on
2

Don't know if this is too late, but I fixed this issue in Linux Lite by opening the port on the firewall (UFW).

sudo ufw allow 22      #replace 22 with whatever port

source: https://www.linuxliteos.com/forums/network/sshd-or-openssh/msg19245/#msg19245

1

I had the same issue where the server was responsive to ping and the logon prompt, but would not accept connections.

Looking at all the related sshd config files I noticed that it was missing the /etc/pam.d/sshd config file.

Since I had VM console access I used scp through the console to copy this config file from another server which resolved the issue.

The command for copying the file from a remote server is:

scp -r root@remoteserver:/etc/pam.d/sshd /etc/pam.d/

Restart the ssh service using this command:

service sshd restart

You should now be able to log on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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