All ArticlesSecurity2026-11-07T00:43:18+08:00

VPS Load Spikes With No Site Traffic? Check auth.log for SSH Brute Force

Your VPS shows high load, memory pressure, or swap use while web traffic is flat, and the cause may be a flood of SSH login attempts. You will learn how to read auth.log or journalctl for failed sshd logins, tie them to the extra sshd processes, and judge whether the attempts are the source of the load.

Load average on your VPS sits well above the number of CPU cores, free memory keeps shrinking, and swap is slowly filling. Yet the access log is quiet and PHP and MySQL barely show up in top. When the web stack looks idle and the box still feels busy, check SSH. A steady stream of login attempts costs the server real work, even when every attempt fails.

Brute-force attacks against SSH are old and common. Any server with port 22 open to the internet usually gets probed constantly. Most of the time the noise is harmless background. It turns into a performance problem when the rate goes up, or when the VPS is small enough that a few hundred extra processes matter. To see why, it helps to know what sshd does for each connection.

What sshd does for every connection, even ones that never log in

The kernel completes the TCP handshake on port 22 and places the connection in the listen queue. The main sshd process, the listener, calls accept() and then forks a child to handle the session. On OpenSSH 9.8 and later, that child also executes a separate binary called sshd-session, which means a fresh process image for every connection.

That child is split again for privilege separation. A privileged monitor process stays root, and an unprivileged child handles the untrusted network traffic. Before any password is checked, each connection already holds at least two processes.

Next comes key exchange. Client and server agree on algorithms, run an elliptic-curve or Diffie-Hellman exchange, and the server signs the result with its host key. That signature runs on your CPU, and it runs for every bot that connects, whether or not it ever sends a password.

Then authentication starts. A password attempt goes through PAM, where pam_unix hashes the candidate password with the salt and algorithm stored in /etc/shadow. Modern password hashes such as SHA-512 crypt or yescrypt are slow on purpose, so they resist offline cracking. That same slowness means every online guess burns a noticeable slice of CPU. When the username doesn't exist, sshd still performs a dummy authentication so response timing doesn't reveal which accounts are real. Invalid usernames are not free either.

Each failure gets written to syslog. journald, rsyslog, and tools like fail2ban that tail the log all do work per line. A connection stays alive until the client gives up, hits MaxAuthTries (default 6), or runs past LoginGraceTime (default 120 seconds). Slow or idle bots can hold a process pair open for up to two minutes without ever completing a login.

Why that shows up as load, memory pressure, and swap

Load average is not CPU percentage. It counts processes that are runnable or stuck in uninterruptible sleep. A flood of connections produces many short-lived processes, each wanting CPU for key exchange and password hashing at roughly the same time, so the run queue grows even if no single process looks heavy in top.

Memory works the same way. One sshd process pair is small, but a few hundred of them on a 1 GB VPS (an illustrative example) push out page cache and eventually force idle pages into swap. When MySQL or PHP-FPM later needs those pages back, the site slows down even though SSH was the cause.

sshd has a built-in brake called MaxStartups. With the default 10:30:100, once 10 connections are waiting to authenticate, sshd starts dropping new ones with a 30 percent probability. That probability rises linearly until every new unauthenticated connection is refused at 100. This caps the damage, but it also means up to 100 pre-auth sessions, each with its own processes, can sit there at once. Your own login attempts can also get dropped during a flood, which is why admins sometimes see an SSH connection reset right when they try to investigate.

Reading auth.log or the journal for failed sshd logins

On Debian and Ubuntu, sshd messages land in /var/log/auth.log. On RHEL, CentOS, AlmaLinux, and Rocky, they go to /var/log/secure. On systemd machines you can also query the journal directly. The unit is usually named ssh on Debian-family systems and sshd on RHEL-family systems.

# Count failed attempts in the current log file (Debian/Ubuntu)
sudo grep -cE 'Failed password|Invalid user' /var/log/auth.log

# Same on RHEL-family systems
sudo grep -cE 'Failed password|Invalid user' /var/log/secure

# Journal, limited to a time window (use -u sshd on RHEL-family)
sudo journalctl -u ssh --since '10 minutes ago' --no-pager | grep -cE 'Failed password|Invalid user'

# Top source IPs by failed password count
sudo grep 'Failed password' /var/log/auth.log | grep -oE 'from [0-9.]+' | sort | uniq -c | sort -rn | head

The time window matters more than the total. A log that has rotated over a week will always show a large count. What you want is the rate during the window when the load was high, so run the journal query with a --since value that covers the spike, then compare it against a quiet period.

The lines themselves tell you what kind of traffic you're dealing with.

# Illustrative output format (IPs from documentation ranges)
sshd[2101]: Invalid user admin from 203.0.113.45 port 51122
sshd[2101]: Failed password for invalid user admin from 203.0.113.45 port 51122 ssh2
sshd[2140]: Failed password for root from 198.51.100.7 port 40318 ssh2
sshd[2140]: error: maximum authentication attempts exceeded for root from 198.51.100.7 port 40318 ssh2 [preauth]
sshd[987]: drop connection #10 from [203.0.113.80]:39004 on [192.0.2.10]:22 past MaxStartups

Invalid user lines show dictionary guessing against usernames that don't exist. Failed password for root means password authentication is enabled and root login is allowed to reach the password stage. Lines tagged [preauth] come from the unprivileged child before login, which confirms the session pair was created and torn down. A drop connection message, where your version logs it, means sshd hit MaxStartups. That is strong evidence the flood was heavy enough to throttle. Exact wording varies between OpenSSH versions, so search loosely if the patterns above return nothing.

If you see one or two IPs dominating, the attack is concentrated and easy to block. If you see hundreds of IPs with a few attempts each, it's distributed, and per-IP blocking will help less.

Tying the log entries to processes and connections

Log lines prove that attempts happened. To connect them to the load you're seeing right now, look at live processes and sockets.

# All sshd-related processes with age, CPU, and memory (RSS in KB)
ps -eo pid,ppid,etimes,pcpu,rss,args | grep -E '[s]shd'

# Established TCP connections to port 22 (output includes one header line)
ss -tn state established '( sport = :22 )' | wc -l

In the ps output, your own sessions usually show your username and a pts terminal. Pre-auth connections show titles such as sshd: [accepted], sshd: unknown [priv], or sshd: root [net], depending on the OpenSSH version. On 9.8 and later, look for sshd-session as well. The etimes column shows age in seconds. Many processes with ages close to LoginGraceTime suggest slow bots holding connections open. Many very young processes suggest fast churn, where the cost is mostly fork, exec, and key exchange.

Add up the rss column for the pre-auth processes to get a rough idea of how much memory SSH is holding. Then compare the count from ss with the pre-auth processes. They should move together during an attack.

Deciding whether SSH is really the cause

A busy auth.log alone doesn't prove anything. Most internet-facing servers log failed SSH logins every day without any performance impact. The question is whether the timing and the numbers line up.

Three checks usually settle it. First, the failed-login rate should rise in the same window as the load. Second, sshd processes should take a visible share of CPU in top, or a visible share of memory once you sum the RSS. Third, load should drop when the connections stop, for example after you block the top IPs at the firewall, while web traffic stays the same.

If failed logins run at a few per minute and sshd barely registers in top, SSH is background noise, and the load is coming from somewhere else. Brute force also targets web logins, and some of it hides in very few requests, so the web layer still deserves a look. On WHM servers, check whether cPHulk or CSF/LFD is already blocking these sources before adding another tool. The trade-offs are covered in cPHulk or CSF/LFD: Which Should Block SSH Brute-Force on a WHM Server?.

Support teams often see this pattern on small, unmanaged VPS plans. Password authentication is still on, port 22 is open to the whole internet, and nothing rate-limits connections. The customer reports a slow site, and the first instinct is to tune PHP or MySQL. Checking the auth log for a couple of minutes before touching the web stack can save a lot of wasted tuning.

When SSH turns out to be the cause, the lasting fix is to make each attempt cheaper or impossible. Switch to key-only authentication, so bots never reach the password hashing stage. Restrict port 22 to known IPs where you can. Let fail2ban or your panel's firewall block repeat offenders. Hardening Linux Web Servers Against SSH Brute Force and Zero-Day Exploits walks through those steps.

Warning: before you disable password login or restrict the port, confirm that key-based login works in a second terminal and that your own IP is allowed. Keep your current session open while you test. A mistake here can lock you out, and on a VPS without console access, recovery may need a rescue boot.

The short version: when load rises with no web traffic, count failed sshd logins in the spike window, match them to pre-auth sshd processes and port 22 connections, and treat SSH as the cause only when all three line up.