Linux kicks off remote login users

Linux kicks off remote login users

Install psmisc

yum install -y psmisc

View remote login users

who

get the following result

[root@centos7 ~]# w
 10:58:13 up 0 min,  2 users,  load average: 0.12, 0.03, 0.01
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
lhz      pts/0    192.168.126.1    10:58    5.00s  0.05s  0.05s -bash
root     pts/1    192.168.126.1    10:58    3.00s  0.12s  0.01s w
[root@centos7 ~]# 

insert image description here

kick user lhz

fuser -k /dev/pts/0

get the following result

[root@centos7 ~]# w
 10:58:13 up 0 min,  2 users,  load average: 0.12, 0.03, 0.01
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
lhz      pts/0    192.168.126.1    10:58    5.00s  0.05s  0.05s -bash
root     pts/1    192.168.126.1    10:58    3.00s  0.12s  0.01s w
[root@centos7 ~]# fuser -k /dev/pts/0
/dev/pts/0:           2301
[root@centos7 ~]# w
 11:00:41 up 2 min,  1 user,  load average: 0.01, 0.02, 0.01
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/1    192.168.126.1    10:58    1.00s  0.14s  0.02s w
[root@centos7 ~]# 

insert image description here

Guess you like

Origin blog.csdn.net/qq_24330181/article/details/131488248