If you are logged into a remote Linux system via SSH you just need to use the exit command to log out of SSH.
Thataposs fine. But what if you want to log out some other user from the SSH connection.
In this quick tip Iaposll show you how you can kick any user off the system.
First check the list of logged-in users to your Linux server. There are various ways to do that. Iaposll use the who command with option -u. This option displays the process ID of the login shell session of the users.
Hereaposs a sample output.
Now imagine that I want to kick use prakash from the SSH session. The process ID of its shell session is 32004. If you kill the login shell session the user will be disconnected.
To do that you can use kill command to send a SIGHUP signal. This signal is used to report that the userx2019s terminal is disconnected. It also effectively disconnects all processes in the session from the controlling terminal.
News Link: https://linuxhandbook.com/logout-user-ssh/.