Tips & Tricks

How to kill SSH user sessions

kill SSH user sessions
kill SSH user sessions

How to kill SSH user sessions

Please use the following commands to kill SSH user sessions. First you need to check how many users are logged into the server by w command.

[root@test ~]# w
 09:55:07   up  1  day,   5:55,   2 users,   load average:   0.96,   0.70,   0.39
 USER    TTY      FROM                            LOGIN@    IDLE     JCPU    PCPU    WHAT
 root        pts/1           09:27           1:30      0.00s     0.00s    -bash
 root        pts/2          09:55           0.00s   0.00s      0.00s    w
 [root@test ~]#

You can find two SSH user sections on the server. Then, you can kill the desired SSH user session using the name of the terminal console (tty). Please use the following command.

pkill -9 -t pts/1

The above command will kill the SSH user session from the IP

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at