DEV Community

Cover image for How to kill unwanted ssh processes
Israel-Lopes
Israel-Lopes

Posted on • Updated on

How to kill unwanted ssh processes

This command will list all connections established with the sshd process. Write down the port number of the process corresponding to the rogue connection and the ID of the process running on that port.

sudo netstat -tnpa | grep 'ESTABLISHED.*sshd'

You can then use the ps command to check the processes running on the system and find the PID corresponding to the port you identified. For example:

sudo ps aux | grep sshd

This will list all running processes related to sshd. Write down the PID of the process running the port you identified.

Finally, run the kill command with the PID of the process you want to kill:

sudo kill <PID>

If you use creativity, you can close http, ftp, telnet and other processes.

Texto alternativo da imagem

Top comments (0)