LEN

Linux 以root用户强制退出其他登录账户
强制退出其他用户 先看看自己是什么用户[root@local ~]#whoami root 查看当前登陆用户信息 ...
扫描右侧二维码阅读全文
19
2017/02

Linux 以root用户强制退出其他登录账户

强制退出其他用户 先看看自己是什么用户

[root@local ~]#whoami
root

查看当前登陆用户信息 w命令

[root@local ~]#w
 21:22:22 up 10:15,  4 users,  load average: 0.12, 0.04, 0.01
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    123.123.123.12   21:13   48.00s  0.00s  0.00s ssh admin.com -p 4
admin    pts/2    123.123.12.11    21:21   45.00s  0.00s  0.00s -bash
root     pts/3    123.123.123.12   21:21   40.00s  0.00s  0.00s -bash
root     pts/4    123.123.123.12   21:21    0.00s  0.02s  0.00s w

查看admin 用户的进程


[root@local ~]#ps -ef |grep -v grep |grep pts/2
admin   3663  3657  0 21:21 ?        00:00:00 sshd: admin@pts/2
admin   3664  3663  0 21:21 pts/2    00:00:00 -bash

杀死进程

[root@local ~]#kill -9 3663
[root@local ~]#ps -ef |grep -v grep |grep pts/2
admin   4138  4132  0 21:23 ?        00:00:00 sshd: admin@pts/2
admin   4139  4138  0 21:23 pts/2    00:00:00 -bash
[root@local ~]#kill -9 4138

再次查看用户

[root@local ~]#w
 21:24:19 up 10:17,  3 users,  load average: 0.01, 0.02, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    123.123.123.12   21:13   36.00s  0.00s  0.00s -bash
root     pts/3    123.123.123.12   21:21    2:37   0.00s  0.00s -bash
root     pts/4    123.123.123.12   21:21    0.00s  0.02s  0.00s w
[root@local ~]#

admin 用户客户端信息

[admin@local~]$ Connection to admin.com closed by remote host.
Connection to admin.com closed.
[root@local ~]#
Last modification:February 19th, 2017 at 09:32 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment