Linux踢掉远程登录用户

Linux踢掉远程登录用户

安装psmisc

yum install -y psmisc

查看远程登录用户

who

得到以下结果

[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 ~]# 

Linux踢掉远程登录用户_第1张图片

踢掉用户lhz

fuser -k /dev/pts/0

得到以下结果

[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 ~]# 

Linux踢掉远程登录用户_第2张图片

你可能感兴趣的:(大数据,云计算,人工智能,linux,运维,服务器)