查看Linux用户登录日志

1. lastlog

使用lastlog可以查看所有用户最近登录的信息:

1
2
3
4
5
6
(base) root@VM-16-4-debian:~# lastlog
Username Port From Latest
root pts/0 10.10.75.10 Sun Mar 24 17:13:34 +0800 2024
daemon **Never logged in**
bin **Never logged in**
sys **Never logged in**

2. last

列出当前和曾经登入系统的用户信息

1
2
3
4
5
(base) root@VM-16-4-debian:~# last
root pts/0 10.10.75.10 Sun Mar 24 17:13 still logged in
root pts/0 10.10.75.10 Fri Mar 22 22:31 - 01:21 (02:49)
root pts/0 10.10.75.10 Fri Mar 22 20:07 - 22:31 (02:24)
root pts/1 10.10.75.10 Fri Mar 22 18:28 - 20:53 (02:25)

3. lastb

列出失败尝试的登录信息

1
2
3
4
5
6
7
(base) root@VM-16-4-debian:~# lastb -50
root ssh:notty 106.55.187.66 Sun Mar 24 17:28 - 17:28 (00:00)
root ssh:notty 183.15.207.112 Sun Mar 24 17:28 - 17:28 (00:00)
root ssh:notty 101.43.137.100 Sun Mar 24 17:28 - 17:28 (00:00)
root ssh:notty 43.156.133.218 Sun Mar 24 17:28 - 17:28 (00:00)
test1 ssh:notty 170.64.190.204 Sun Mar 24 17:28 - 17:28 (00:00)
test1 ssh:notty 170.64.190.204 Sun Mar 24 17:28 - 17:28 (00:00)

请我喝杯咖啡吧~

支付宝
微信