Tuesday, June 28, 2011

How to Disconnect Remote Sessions

admn@obi-wan:~$ w
 11:54:26 up 3 days, 12:55,  1 user,  load average: 0.00, 0.02, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
admn     pts/0    192.168.88.1     11:01    0.00s  0.18s  0.00s w


You could just find the PID of the shell, then kill it.
admn@obi-wan:~$ sudo ps -ef|grep pts/0
admn     20695 20688  0 11:01 ?        00:00:00 sshd: admn@pts/0


admn@obi-wan:~$ sudo kill -9 20695

1 comment:

  1. you can use a different approach.

    user@user:~$ w
    12:07:11 up 2 days, 22:35, 4 users, load average: 1.25, 0.96, 0.83
    USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
    user tty7 :0 Mon13 2days 55:20 0.93s gnome-session
    user pts/1 :0.0 11:54 9:01 0.24s 0.24s bash
    user pts/2 :0.0 10:40 3.00s 0.22s 0.02s ssh monitor01
    user pts/3 :0.0 12:07 0.00s 0.20s 0.01s w
    user@user:~$ fuser -k /dev/pts/2
    /dev/pts/2: 18974 19117
    user@user:~$

    ReplyDelete