ssh Connection refused: how to troubleshoot?
You don't have an SSH daemon running. If you look at the output from the ps ax
command, you see that the only two processes with 'ssh' in the description are ssh-agent
(which does something entirely different from sshd
) and the grep ssh
process that you're using to filter the output of ps
.
Depending on what distribution installed, you may need to install or run the ssh
server, usually called openssh-server
or sshd
depending on your package manager.
Steps for debugging the above problem:
Use
nmap
tool to know which ports are open in that server.nmap
is a port scanner. Since it may be possible that ssh server is running on a different port.nmap
will give you a list of ports which are open.$ nmap myserver
2 . Now you can check which server is running on a given port. Suppose in the output of nmap, port 2424 is open. Now you can which server is running on 2424 by using nc(netcat) tool.
$ nc -v -nn myserver portno
Suppose the output of 2424 port is:
myserver 2424 open
SSH-2.0-OpenSSH_5.5p1 Debian-4ubuntu5
This means ssh is running on 2424.
Keep on changing the portno in the above command and check for all the ports which are listed open by nmap.
That means either the ssh server isn't running on that machine or the firewall isn't allowing ssh through. You can check if ssh is running with 'ps -ax | grep ssh'.