How to Log Out a User Off SSH in Linux

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.

...

Read Full Post

News Link: https://linuxhandbook.com/logout-user-ssh/.

Linux Chatter is a news aggregator service that curates some of the best Linux, Cloud, Technical Guides, Hardware and Security news. We display just enough content from the original post to spark your interest. If you like the topic, then click on the 'read full post' button to visit the author's website. Use Linux Chatter to find content from amazing authors!

Note: The content provided has been modified and is not displayed as intended by the author. Any trademarks, copyrights and rights remain with the source.

Disclaimer: Linux Chatter sources content from RSS feeds and personal content submissions. The views and opinions expressed in these articles are those of the authors and do not necessarily reflect those of Linux Chatter.