September 28, 2014

soltveit.org

..Geekish..

Linux – How to kick SSH users

Actions-im-kick-user-iconThis can be useful if a connection get stuck, or you see a suspicious IP of your users.
If you run w or who you will see you current logged on users. You can click on the pictures for a slightly bigger version.
kick-ssh-users1

 

 

Only 2 users on here, but I need for various reasons to kick the user Ronny from the system now.
We can do that by killing his sshd process. So we run ps aux | grep sshd
kick-ssh-users2

 

 

We had identified the process for the user. The owner of the process is Ronny, and the process is sshd: ronny@pts
so we know this is the ssh user Ronny we want to kick. Go ahead and kill 25457

And BAM! The user is kicked from your system.

Happy kicking!