相关命功能如下所示
who命令显示当前登录用户的信息
[root@i-xxxxxxx ~]# whoroot pts/0 2021-04-10 14:07 (192.168.xxx.xxxx)
w命令显示当前登录的用户名并显示该用户当前执行的任务
[root@i-xxxxxxx ~]# w 14:11:22 up 4 min, 1 user, load average: 2.43, 1.45, 0.61USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATroot pts/0 192.168.255.254 14:07 2.00s 0.04s 0.00s wCopy
users命令显示当前登录的用户名
[root@i-xxxxxxxx~]# usersroot
last命令显示当前与过去登录系统的用户信息
[root@i-xxxxxxxx ~]# lastbroot tty1 Wed Apr 7 10:19 - 10:19 (00:00) root tty1 Thu Apr 1 09:58 - 09:58 (00:00) btmp begins Thu Apr 1 09:58:34 2021Copy
lastlog命令显示用户最后一次登录的信息
[root@i-xxxxxxxx ~]# lastlog用户名 端口 来自 最后登录时间root pts/0 192.168.255.254 六 4月 10 14:07:20 +0800 2021bin **从未登录过**daemon **从未登录过**adm **从未登录过**lp **从未登录过**sync **从未登录过**shutdown **从未登录过**halt **从未登录过**mail **从未登录过**Copy
secure文件查看登录记录
[root@i-xxxxxxxx ~]# cat /var/log/secureApr 10 14:07:15 i-71lpe3fm polkitd[486]: Acquired the name org.freedesktop.PolicyKit1 on the system busApr 10 14:07:16 i-71lpe3fm sshd[864]: Server listening on 0.0.0.0 port 22.Apr 10 14:07:16 i-71lpe3fm sshd[864]: Server listening on :: port 22.Apr 10 14:07:19 i-71lpe3fm sshd[1004]: Accepted password for root from 192.168.255.254 port 55696 ssh2Apr 10 14:07:19 i-71lpe3fm sshd[1004]: pam_unix(sshd:session): session opened for user root by (uid=0) |