I am able to see logged-in users via the who or last command.
How can I log off a particular user who login through SSH?
I am able to see logged-in users via the who or last command.
How can I log off a particular user who login through SSH?
kill its ssh session. Check them by
ps aux | egrep "sshd: [a-zA-Z]+@"
Second column gives you the PID. Then,
sudo kill [-9] PID
Hope this helps.
ps: using the -9 flag will prevent things from stopping "graciously".
I found this guys. Just replace USERNAME with the desired user session to be killed.
kill [-9] $(ps aux | grep USERNAME@ | head -n 1 | tr -s ' ' | cut -f 2 -d ' ')
As mentioned above, using the -9 flag will prevent things from stopping "graciously".