1、查看当前登录的用户
[root@mgt ~]# w 18:08:27 up 40 days, 8:16, 5 users, load average: 0.01, 0.21, 0.36 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT geohpc pts/0 192.168.13.7 16:23 51:13 0.08s 0.08s -bash geohpc pts/1 192.168.13.1 14:50 51:28 0.23s 0.02s sshd: geohpc [priv] root pts/2 192.168.13.7 18:06 0.00s 0.03s 0.01s w geohpc pts/5 192.168.13.7 17:31 23:41 0.04s 0.04s -bash geohpc pts/7 192.168.13.17 17:44 15:14 0.03s 0.03s -bash
2、强制踢出用户
[root@mgt ~]# pkill -kill -t pts/0 [root@mgt ~]# pkill -kill -t pts/1 [root@mgt ~]# pkill -kill -t pts/5 [root@mgt ~]# pkill -kill -t pts/7
3、查看是否踢出成功(看,只剩下了我:root)
[root@mgt ~]# w 18:08:45 up 40 days, 8:16, 1 user, load average: 0.07, 0.22, 0.36 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/2 192.168.13.7 18:06 0.00s 0.02s 0.00s w
4、更改用户密码
[root@mgt ~]# passwd geohpc Changing password for user geohpc. New password: Retype new password: passwd: all authentication tokens updated successfully.