Sometimes you just want to kick or force logout other users on the SSH sell like bash. There are various reason for this: maybe you just want to eradicate your double login, maybe you own a server and allow other users to login to your server and this user just long enough using the server that make you pissed of or this user had run a process that eat a lot of server resources. So, here’s a way to kick that particular user:
Login as root to your SSH server
use “w” command to check which user logged in which terminal and currently running what command
As you can see in the above screenshot, there are 2 root users currently logged in the server. The first “root” logged in via “pts/0” virtual terminal and currently running “htop” command (see in “WHAT” column). Let’s say that we want to kick this “root” user in “pts/0“.
Next, we need to find the sshd process that this root user is currently use. Do type this command
ps aux| grep pts/0
kill -9 2098
To make sure, do “w” command again