Linux 终端用户管理

公司年终奖发了台surface pro4, 好开心 :) 从此我的linux需要管理mac os 和 windows 终端用户了

Linux查看和剔除当前登陆用户

查看登陆用户列表

1
2
3
[root@xiie-aliyun ~]# who
root pts/0 2017-01-22 23:40 (113.57.48.91)
root pts/1 2017-01-22 23:40 (113.57.48.91)

查看登陆用户行为

1
2
3
4
5
[root@xiie-aliyun ~]# w [要具体查看的用户名]
23:43:50 up 32 min, 2 users, load average: 0.00, 0.01, 0.03
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 113.57.48.91 23:40 6.00s 0.00s 0.00s w
root pts/1 113.57.48.91 23:40 38.00s 0.01s 0.01s -bash

查看登陆用户历史

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@xiie-aliyun ~]# last [要具体查看的用户名]
root pts/1 113.57.48.91 Sun Jan 22 23:40 still logged in
root pts/0 113.57.48.91 Sun Jan 22 23:40 still logged in
root pts/0 113.57.48.91 Sun Jan 22 23:24 - 23:40 (00:16)
root pts/1 113.57.48.91 Sun Jan 22 23:13 - 23:30 (00:16)
root pts/0 113.57.48.91 Sun Jan 22 23:12 - 23:23 (00:11)
reboot system boot 3.10.0-327.36.3. Mon Jan 23 07:11 - 23:46 (-7:-25)
root pts/0 180.90.18.47 Thu Jan 5 23:04 - 02:05 (03:01)
root pts/0 180.90.18.47 Thu Jan 5 22:42 - 22:57 (00:14)
root pts/0 180.90.18.47 Wed Jan 4 22:44 - 22:44 (00:00)
root pts/0 49.211.77.178 Tue Dec 27 22:03 - 01:49 (03:45)
root pts/1 49.211.77.178 Mon Dec 26 22:48 - 23:44 (00:56)
root pts/0 49.211.77.178 Mon Dec 26 22:39 - 23:44 (01:05)

安全剔除用户

1
2
[root@xiie-aliyun ~]# ps -ef | grep pts/0
[root@xiie-aliyun ~]# kill -9 pid