Linux: follow failed SSH logins in the logs
journalctl and tail commands to watch errors and failed SSH passwords live.
To troubleshoot failed SSH logins on Linux, follow the system logs and the authentication log live, filtering on errors.
# Errors and failures since boot, live (journald)
journalctl -b -f | grep -i -E 'error|failed'
# Failed passwords in the authentication log, live
sudo tail -f /var/log/auth.log | grep -i "Failed password"
How it works
journalctl -b -fshows the current boot's logs (-b) and waits for new lines (-f);grep -i -Efilters case-insensitively onerrororfailed.tail -f /var/log/auth.logfollows the authentication file; the filter keeps onlyFailed passwordlines.
Notes
/var/log/auth.logexists on Debian/Ubuntu; on other distributions (RHEL, Fedora, Arch without rsyslog) usejournalctl -u sshd(orssh) instead.