动机
Linux系统为多用户多任务系统,因此允许多个用户登录到系统,有时候,我们需要强制某些用户下线.
操作
查看在线用户
user@debian9:~$ who
user tty1 2018-01-16 07:11 (:0)
user pts/0 2018-01-16 13:59 (192.168.88.167)
user pts/1 2018-01-16 14:12 (192.168.88.168)
user pts/2 2018-01-16 14:42 (192.168.88.169)
查看过去什么时间登录过系统
user@debian9:~$ last user
pxc pts/4 14.25.74.179 Tue Jan 16 15:28 still logged in
user pts/3 183.12.67.198 Tue Jan 16 14:56 still logged in
user pts/2 184.55.74.179 Tue Jan 16 14:42 still logged in
user pts/1 184.55.74.179 Tue Jan 16 14:12 still logged in
user pts/0 183.12.67.198 Tue Jan 16 13:59 still logged in
user tty1 :0 Tue Jan 16 07:11 still logged in
user pts/0 192.168.88.168 Tue Jan 16 03:33 - 03:34 (00:00)
user pts/0 192.168.88.186 Sun Jan 14 20:33 - 21:58 (01:25)
user pts/0 181.6.79.173 Sat Jan 13 11:13 - 11:20 (00:06)
user pts/0 181.6.79.173 Sat Jan 13 11:07 - 11:12 (00:05)
强制下线
user@debian9:~$ sudo pkill -kill -t pts/1
命令解释:pts/1 对应的是该用户的TTY。
网友评论