Theory · 9 min · Linux monitoring
Linux authentication logs
Read sshd and sudo lines and find the guess that worked.
On Debian and Ubuntu, authentication messages go to /var/log/auth.log; on Red Hat family systems to /var/log/secure. On systemd machines journalctl shows the same messages (journalctl -u ssh or -u sshd).
sshd writes "Failed password for invalid user admin from 203.0.113.9 port 51122 ssh2" for a guess on a non-existent account, "Failed password for root" for a wrong password, and "Accepted password" or "Accepted publickey" for a success.
sudo logs who ran what as root: the user, the terminal, the working directory and the command. A web server account running sudo is worth a look on its own.
Hundreds of failures from one IP, then an "Accepted" from the same IP, is a brute force that worked. "Accepted publickey" from an unknown address may mean a stolen key, or a key the attacker added.
Your turn: select the field that proves it. Select the line where the attacker got in.
Do the interactive check Free, in the browser.
Sources
- sshd(8) manual page Ubuntu
- ATT&CK T1110.001: Brute Force: Password Guessing MITRE ATT&CK v20