Sunday, May 5, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2193  / 1 Year ago, sun, may 21, 2023, 12:11:34

I have read this these generic instructions to log users out, but I want more detail.



When I run the command users I see multiple instances of the same user. IE:
Joe Joe Joe Joe Joe



How do I know if Joe is active? How would I find more information about what Joe is doing in each session? (like can I close a session Joe has open, and not loose his work?)



I am familiar with the w command. Say this user left his terminal on at home, then came into work; but rebooting the server isn't a good idea, I just used the command



pkill -KILL -u Joe bash 


This threw me out of the shell and out of the open-shell from home, with no idea if I'm loosing work in this process.



What can be done to help me evaluate which sessions can be closed safely?



I tried



skill -KILL -v /dev/pts/1 


to kill a specific session, but nothing happened.


More From » command-line

 Answers
2

I would recommend using w to identify the idle tty, then send it SIGHUP:



pkill -SIGHUP -t pts/5



SIGHUP (the hangup signal) will terminate the session more gracefully, almost as if the user had issued the logout command herself. SIGKILL should always be a last resort.


[#30363] Tuesday, May 23, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
landarre

Total Points: 254
Total Questions: 96
Total Answers: 109

Location: Burundi
Member since Sun, Apr 16, 2023
1 Year ago
landarre questions
;