The short answer
Failed attempts are normal. Check that no login succeeded from an address you do not know, then switch to SSH keys, turn off password login and add Fail2ban or a firewall rule.
See the attempts
sudo grep 'Failed password' /var/log/auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head
sudo lastb | headOn systems without auth.log, use sudo journalctl -u ssh --since yesterday. On Red Hat family systems the file is /var/log/secure.
Check what matters: successful logins
last -n 20
sudo grep Accepted /var/log/auth.log | tailDo you recognise every address and time? An unknown success is an incident. Change passwords and keys, check for new users, new cron jobs and unknown processes, and ask for help.
Lock it down
- Use SSH keys and set
PasswordAuthentication noin /etc/ssh/sshd_config. - Set
PermitRootLogin noand use a normal user with sudo. - Restrict who can log in with
AllowUsers. - Limit the source addresses in the firewall if you have a fixed address.
- Install Fail2ban or CSF to block repeated failures.
Other steps
- Change the SSH port if you like. It reduces noise but is not real security.
- Turn on two-step login for the control panel and hosting account.
- Keep the system updated.
Test before you close the session
Open a second terminal and test a new login before you log out. A wrong SSH setting can lock you out. Keep a console login ready.
Questions people ask
Is it dangerous to have many failed logins?
Not by itself. Strong keys and no password login make guessing useless. The risk is a weak password that is guessed.
Does Fail2ban stop attacks?
It slows guessing and keeps logs clean. It does not replace keys.
What if I find a login I do not know?
Treat the server as compromised: change credentials, check users and cron jobs, keep logs, and get help before you rebuild.