List failed login attempts with `lastb`
The forgotten counterpart of `last`: lastb reads /var/log/btmp and shows every failed login — the quickest way to see whether your SSH server is being brute-forced.
Run `sudo lastb | head -30` to show the most recent failed logins with username, source IP and timestamp.
01Command
Command
$ sudo lastb | head -3002What it does
While `last` reads /var/log/wtmp for successful logins, `lastb` reads the companion file btmp where failed attempts are logged. On any public-facing SSH server, pages of entries with usernames like admin, root and test from random IPs are normal brute-force noise — what matters is repeated failures that suddenly succeed. Useful forgotten flags: `lastb -n 50` to limit lines, `lastb root` to filter by user, and `lastb -s '2026-09-01'` to start at a date.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- last(1), lastb(1) — list logins, lastb lists bad loginsEvidence: Documents lastb as reading /var/log/btmp to show failed login attempts, with user/host/time columns
Last verified: 2026-09-17 · Category: Security & Privacy