Linux – Cannot log in into a server by ssh connection

linuxportssh

was connected to a server via ssh through port 22, and decided to kill all the users connected with the root user with the following command:

pkill -9 -u root

Now when I try to log in by root@190.169.94.56, I get the message:

ssh: connect to host 190.169.94.56 port 22: Connection refused

I make sure that SSH is indeed running on the port 22. On the server machine, I run:

 netstat -untap | grep 190.169.94.56
    (Not all processes could be identified, non-owned process info
    will not be shown, you would have to be root to see it all.)
    tcp        0      0 190.169.94.9:41267      190.169.94.56:22        ESTABLISHED 29673/ssh

I did ping the server 190.169.94.56 and responds correctly:

ping 190.169.94.56
PING 190.169.94.56 (190.169.94.56) 56(84) bytes of data.
64 bytes from 190.169.94.56: icmp_seq=1 ttl=64 time=0.524 ms
64 bytes from 190.169.94.56: icmp_seq=2 ttl=64 time=0.454 ms
64 bytes from 190.169.94.56: icmp_seq=3 ttl=64 time=0.423 ms
64 bytes from 190.169.94.56: icmp_seq=4 ttl=64 time=0.419 ms
--- 190.169.94.56 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.419/0.455/0.524/0.042 ms

I tried change the port and i obtain the same result. How can I connect to it again? It's a Debian machine, in case that matters.

Best Answer

To check if it is running, you would have to run netstat -tnpl | grep :22 and ps aux | grep sshd. SSHD keeps your connection open even if you stop it so that you don't lose control over the server if you make, for example, a mistake in sshd_config before restarting it.

EDIT:

I confess that only now I saw your pkill -u root -9 command. This is VERY wrong and I would tell you to actually reboot your server because you killed important system processes (like the log daemon and so on).