Repeated failed SSH logins can indicate a brute-force attempt to guess account credentials. This guide explains how to inspect Linux authentication logs and distinguish failed attempts from evidence of a successful login.
Inspect recent SSH logs
You need administrator permission to read authentication logs. On systems that record SSH messages in the systemd journal, try the unit used by your distribution:
sudo journalctl -u sshd --since '1 hour ago' --no-pagerOn systems using ssh.service, use:
sudo journalctl -u ssh --since '1 hour ago' --no-pagerIf the distribution writes authentication logs to files, inspect the appropriate file instead:
sudo grep 'Failed password' /var/log/auth.logsudo grep 'Failed password' /var/log/secureauth.log is commonly used on Debian and Ubuntu; secure is commonly used on RHEL-family systems. File logging depends on the server’s configuration, and these commands do not include rotated logs.
Review the pattern
Look for repeated failures, invalid usernames and a large number of attempts within a short period. Compare the timestamps, source addresses and targeted users. Review Accepted login messages around the same time to identify successful connections you do not recognise.
Failed attempts show that someone tried to log in, not that they succeeded. A shared or changing source address also means an IP count alone is not reliable proof of who made the attempts.
Check existing monitoring
Where the system records failed sessions in btmp, this command can provide another view:
sudo lastbIf Fail2Ban is already configured, list its jails before checking the SSH jail:
sudo fail2ban-client status
sudo fail2ban-client status sshdUse the actual jail name from your configuration. A banned address is a result of those rules, not proof that the server was compromised.
Investigate unexpected successful logins and protect the log evidence. For hardening, test key-based access and recovery access before disabling passwords or changing SSH settings.