Hi friends,
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 suresh@192.168.1.9
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.
🙂
you are genius!
thank you
Hi friend…. I get this error bash: /etc/init.d/sshd: No such file or directory
i have folders upto /etc/init.d but sshd is not present..wat to do now…
Dear Theopaul,
I think, you didn’t install “openssh-server” in your system. Which distro you are currently using? If you have any more doubts feel free to contact me 🙂
Thanks a lot.. 😉
‘$/etc/init.d/sshd start’
-bash: $/etc/init.d/sshd start: No such file or directory
please help
sudo service ssh start
Hi,
I wanted to know how to check secure shell (ssh) connections on port 22 of system’s Ethernet interface ???
hi,
i am getting Permission denied .please try again later when i enter ssh localhost..
please help….
root@nagios-desktop:/# ssh localhost
root@localhost’s password:
Permission denied, please try again.
root@localhost’s password:
root@nagios-desktop:/#
@valentin: If you did not find out yet, sshd is usually configured to block root login via ssh. So either allow it in /etc/ssh/sshd_config (insecure option) or ssh as a normal user and use sudo / su / sudo bash (depending on your distro).
Hi Suresh,
I install Cgywin and new to linux,…when i am giving ssh localhost command i got the same port 22 error and when i tried to give the “pgrep” command it gives me below error –
– bash : pgrep : command not found
please help.
Hi all,
I have also come across the similar problem mentioned above,I need to study mininet-vm and I am using Ubuntu-16.04 LTS machine 64 bit, actually I also installed both open-ssh-server and open-ssh client in my computer.While I am able to connect to some machines like Ubuntu in VirtualBox or any other physical computer, I downloaded mininet-vm and then imported it in virtualbox,after that a neccessity appears like ssh connection between mininet-vm which is a Linux like machine and my local computer.All these have open-ssh-server or client.I can be able to reach via ssh from mininet-vm to my local,however,I can not reach to mininet from my local.How can I solve such a problem ssh: connect to host 192.168.56.195 port 22: No route to host?
I also added a forwarding rule to sth like this
HostIp host-port Guest-Ip Guest-Port
192.168.56.195 2222 192.168.1.123 22
I also tried removing ssh and then reinstall it.Both conditions did not work for me.