Linux command
lastb 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Example
sudo lastb
Example
sudo lastb -s [YYYY-MM-DD]
Example
sudo lastb -t [YYYY-MM-DD]
Example
sudo lastb -p [YYYY-MM-DD HH:MM]
Example
sudo lastb -d
Example
sudo lastb -n [10]
Example
sudo lastb -F
Example
sudo lastb -f [/var/log/btmp.1]
说明
lastb is the same as last, but shows failed login attempts as recorded in /var/log/btmp. It is useful for security auditing to identify brute force attacks or unauthorized access attempts. The output shows username attempted, terminal, source address, and timestamp of each failed login.
参数
- -s, --since _TIME_
- Display records since specified time
- -t, --until _TIME_
- Display records until specified time
- -p, --present _TIME_
- Display users who were present at specified time
- -d, --dns
- Translate IP addresses to hostnames
- -n, --limit _NUM_
- Limit output to NUM records
- -f, --file _FILE_
- Read from specified file instead of /var/log/btmp
- -F, --fulltimes
- Print full login and logout times and dates
- -i, --ip
- Display IP addresses instead of hostnames
- -R, --nohostname
- Suppress display of the hostname field
- -w, --fullnames
- Display full user and domain names
- -x, --system
- Display system shutdown entries and run level changes
- --time-format _FORMAT_
- Output timestamp format: notime, short, full, or iso
FAQ
What is the lastb command used for?
lastb is the same as last, but shows failed login attempts as recorded in /var/log/btmp. It is useful for security auditing to identify brute force attacks or unauthorized access attempts. The output shows username attempted, terminal, source address, and timestamp of each failed login.
How do I run a basic lastb example?
Run `sudo lastb` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -s, --since _TIME_ do in lastb?
Display records since specified time