Pages

Wednesday, 8 March 2017

Kicking local / remote users out of a linux system

Get a list of current tty (console users) / pts (remote users e.g. ssh etc.) with:

who -a

LOGIN      tty1         2017-02-23 13:14              2432 id=tty1
           system boot  2017-02-23 13:13
           run-level 5  2017-02-23 13:14
youruser ? :0           2017-02-23 13:14   ?          2733 (console)
youruser + pts/0        2017-03-08 15:15   .         32548 (10.11.12.13)

and 5th column represents the session PID - we can then kill the user's SSH session with:

kill -9 32548

No comments:

Post a Comment