A budget VPS received its first SSH attack 10 minutes 50 seconds after boot. I measured the logs before and after hardening to find out what the attackers were actually doing.
Key Takeaways
- The timeline: First attack arrived 10m50s after boot, with nothing but port 22 exposed.
- The peak: 52 attack events in roughly 2 minutes, then
Failed passwordstops entirely. - Why it stops:
PasswordAuthentication nocuts connections at[preauth], so passwords are never tried. - The trap:
fail2banstops firing after hardening because failures never reach the auth stage.
- Summary
- Test Environment
- The First Attack Arrived After 10m50s
- The Attack Was a Generic Dictionary Scan
- The Attack Peaked at 32 Events per Minute
- I Changed the Configuration at 07:00:17
- I Attacked My Own Server to See What Gets Logged
- Before and After Hardening
- fail2ban Stops Firing After Hardening
- What This Shows
- Summary
Summary
The attacks started almost immediately, peaked within two minutes, and then appeared to stop. They did not stop. Attackers simply could no longer reach the authentication stage.
This article shows the raw logs and the exact configuration change.
Test Environment
| Item | Value |
|---|---|
| VPS | KVM VPS (2 vCPU / 2.5 GB) |
| OS | Ubuntu 24.04 LTS |
| Exposure | SSH only (no web server) |
Nothing was published on this server. No web server, no application, only SSH.
The First Attack Arrived After 10m50s
Here is when the system booted and when sshd started.
uptime -s
journalctl -u ssh --no-pager -o short-iso | head -3Output:
2026-11-27 06:48:55
2026-11-27T06:49:06+00:00 vps-host systemd[1]: Starting ssh.service - OpenBSD Secure Shell server...
2026-11-27T06:49:06+00:00 vps-host sshd[859]: Server listening on :: port 22.
2026-11-27T06:49:06+00:00 vps-host systemd[1]: Started ssh.service - OpenBSD Secure Shell server.The first attack looked like this.
journalctl -u ssh --no-pager -o short-iso | grep -E "Failed password" | head -1Output:
2026-11-27T06:59:45+00:00 vps-host sshd[1507]: Failed password for root from 201.18.245.x port 12270 ssh2That is 10 minutes 50 seconds after boot. The server was not serving anything. Port 22 was simply reachable from the internet.
The Attack Was a Generic Dictionary Scan
I grouped the usernames the attackers tried.
journalctl -u ssh --no-pager | grep -oE "Invalid user [^ ]+" | awk '{print $3}' | sort | uniq -c | sort -rnOutput:
7 usuario
7 user
7 test
7 oracle
7 admin
5 ftpuserThis is a generic credential scan, not a targeted campaign. Two IP addresses produced every attempt.
| IP | Log lines | Method |
|---|---|---|
| 201.18.245.x | 149 | Dictionary attack against root and common usernames |
| 92.118.39.x | 20 | Root only, every four minutes |
The Attack Peaked at 32 Events per Minute
Grouping by minute shows how concentrated the traffic was.
journalctl -u ssh --no-pager -o short-iso | grep -E "Invalid user|Failed password" | cut -c1-16 | sort | uniq -cOutput:
20 2026-11-27T07:00
20 2026-11-27T07:01Password attempts started slightly earlier.
5 2026-11-27T06:59
7 2026-11-27T07:00All of it fits inside 06:59:45 to 07:01:33, about two minutes. After 07:01:33, external Failed password events stop completely.
I Changed the Configuration at 07:00:17
I applied SSH hardening almost exactly at the peak. This is the file I created.
sudo cat /etc/ssh/sshd_config.d/00-hardening.confOutput:
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
AllowUsers pcparts001
MaxAuthTries 3
LoginGraceTime 30
X11Forwarding noI validated the syntax and reloaded the service.
sudo sshd -t && sudo systemctl reload sshThe effective values after the reload:
permitrootlogin no
passwordauthentication no
pubkeyauthentication yes
allowusers pcparts001
maxauthtries 3The reload happened at 07:00:17. The last attack was logged at 07:01:33.
I Attacked My Own Server to See What Gets Logged
This is the interesting part. After hardening, I tried password authentication myself and checked the server log.
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no ftpuser@<VPS_IP>Output:
ftpuser@<VPS_IP>: Permission denied (publickey).The server recorded this.
sudo journalctl -u ssh --no-pager -n 20 -o short-isoOutput:
Invalid user ftpuser from 203.0.113.x port 39798
Connection closed by invalid user ftpuser 203.0.113.x port 39798 [preauth]
User root from 203.0.113.x not allowed because not listed in AllowUsers
Connection closed by invalid user root 203.0.113.x port 39812 [preauth]
Connection closed by authenticating user pcparts001 203.0.113.x port 39820 [preauth]Three things are visible here.
- Unknown users are rejected right after the
Invalid userline, marked[preauth] - Users outside
AllowUsersare rejected before any credential check - Existing users never produce
Failed password, because password auth is disabled
The disappearance of Failed password is not a drop in attacker interest. It means the attackers could not submit a single password.
Before and After Hardening
| Period | Attack events | Failed password |
|---|---|---|
| Before (06:49 to 07:00:17) | 10 | 12 |
| After (07:00:18 to 08:47) | 57 | 2 (both my own test) |
Connection attempts continue after the change. None of them reach the authentication stage, so no password can be guessed.
fail2ban Stops Firing After Hardening
I expected fail2ban to ban the scanners. It did not.
sudo fail2ban-client status sshdOutput:
Currently failed: 1
Total failed: 8
Currently banned: 0
Total banned: 1The single ban was the pre-hardening attacker, 201.18.245.x. The new IP, 92.118.39.x, keeps trying and is never banned.
The reason is structural. Connections are closed at [preauth], so fail2ban never counts an authentication failure. The server cannot be breached this way, but the log keeps growing.
What This Shows
- A fresh VPS receives generic SSH attacks within about 10 minutes
- Roughly 52 attack events arrived in two minutes and then stopped reaching the auth stage
Failed passworddisappearing is evidence of pre-auth rejection, not of attackers giving upfail2banis a last line of defence, not the first control to rely on
"Attacks stopped" and "attackers gave up" are different things. Reading [preauth] makes the difference obvious.
Summary
- Any internet-facing server is scanned within minutes of boot. There is no grace period
- The three settings that matter are key-only auth, no root login, and
AllowUsers - Watch for
[preauth]before trusting a drop inFailed password fail2bancomplements hardening. It does not replace it



コメント