Since three days, i had problem with my ssh connection. When i was tried to connect my laptop to others machine, I’m able to connect with them. But when i tried to connect, others machine to my laptop, I got this Error.
[student@mercury ~]$ ssh firstname.lastname@example.org
ssh: connect to host 192.168.1.9 port 22: Connection refused
Solution for this “port 22: Connection refused” :
First check if sshd is running by trying the command ‘$ pgrep sshd‘
on the host. If the output is empty, its very likely that sshd is not
running. Try ‘tail -f /var/log/messages’ on one terminal and do
a ‘$ /etc/init.d/sshd start‘ on another terminal. Then, check the
output that comes up on the previous terminal.
if PID comes, like 1702(any number), we conform the “sshd” is running.
Next, we have to flush the “iptables” by using the following command,
$ sudo iptables -F
That’s all. Now you can connect with anyone via ssh.
If again the same problem appear, Try ‘$ grep sshd /var/log/messages | tail‘ and
‘$ grep ssh /var/log/secure | tail‘ and check for any possible issues.