标题:linux下如何查看最后登陆的几位用户的详细信息? 出处:向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除 时间:Tue, 27 Jun 2017 22:23:29 +0000 作者:jackxiang 地址:http://jackxiang.com/post/9294/ 内容: 背景:突然Mount的磁盘脱落挂载了,是不是有人上去做过安全给搞丢了?想看看都是谁? last -20 lastlog |less Linux下查看用户登陆历史记录,可以用root用户下的last命令查看: 1.查看单个用户的操作历史 [root@DB-Server ~]# cat /home/username/.bash_history #username要查看的用户名 2.使用root登陆可查看用户登陆历史 [root@DB-Server ~]# su root [root@DB-Server ~]# last -10 root pts/1 :0.0 Wed Dec 18 09:54 still logged in root pts/4 :0.0 Wed Dec 18 09:43 - 09:48 (00:04) root pts/1 :0.0 Wed Dec 18 09:43 - 09:48 (00:05) root pts/3 192.168.103.79 Wed Dec 18 09:41 - 12:40 (02:59) root pts/4 :0.0 Wed Dec 18 09:28 - 09:30 (00:01) root pts/3 :0.0 Wed Dec 18 09:27 - 09:30 (00:02) root pts/2 192.168.103.29 Wed Dec 18 09:27 still logged in root pts/1 :0.0 Wed Dec 18 09:27 - 09:42 (00:15) root pts/2 :0.0 Wed Dec 18 09:23 - 09:25 (00:01) root pts/1 :0.0 Wed Dec 18 09:22 - 09:25 (00:02) #查看最近10次用户历史操作记录 last 命令: 功能说明:列出目前与过去登入系统的用户相关信息。 语 法:last [-adRx][-f ][-n ][帐号名称…][终端机编号…] 参 数: -a 把从何处登入系统的主机名称或IP地址,显示在最后一行; -d 将IP地址转换成主机名称; -f 指定记录文件; -n 或- 设置列出名单的显示列数; -R 不显示登入系统的主机名称或IP地址; -x 显示系统关机,重新开机,以及执行等级的改变等信息; lastlog可简单查看所有用户最后一次的登陆时间。 来自:https://zhidao.baidu.com/question/91897351.html Generated by Jackxiang's Bo-blog 2.1.1 Release