How to Tell If Your Linux Server Has Been Hacked: Warning Signs and First Steps
Most server compromises don't announce themselves. There's no ransom note and no defaced homepage. Instead there's a creeping sense that something isn't right: the load average is higher than it should be, outbound mail is bouncing, or there's a login you don't recognise.
If you run a Linux server, whether it hosts websites, email or an application, it helps to know what the early signs look like and what to do about them. This guide covers both.
Why compromises often go unnoticed
Attackers who get into a server usually want to stay there. A quietly compromised machine can send spam, mine cryptocurrency, host phishing pages or act as a stepping stone to other systems. All of that works best if the owner doesn't notice. So rather than looking for something dramatic, look for small changes in behaviour.
Common warning signs
Performance and resource changes
- Unexplained high CPU usage, especially from processes with odd or generic-sounding names. Cryptominers are a frequent culprit.
- Unusual network traffic, particularly outbound connections to addresses you don't recognise, or a sudden jump in bandwidth.
- Disk space filling up with files you didn't put there, often in temporary directories.
Email problems
- Your server's IP appearing on blocklists, or legitimate mail suddenly being rejected or sent to spam.
- A large outbound mail queue full of messages you didn't send.
- Bounce messages for emails you have no record of.
Accounts and access
- New user accounts, especially any with administrator (root-equivalent) privileges.
- Unfamiliar SSH keys added to an account's authorised keys file.
- Logins at odd hours or from unexpected locations.
- Passwords that no longer work when you haven't changed them.
Files and configuration
- Modified website files, such as injected code in PHP or JavaScript files, or new files in upload folders.
- New scheduled tasks (cron jobs) that you didn't create.
- Log files that are missing, truncated or have gaps, which can indicate someone covering their tracks.
- Firewall rules or service settings that have changed without explanation.
Checks you can run yourself
None of these will give you a definitive answer on their own, but together they can tell you whether something deserves a closer look. Exact commands vary slightly between distributions.
| What to check | Where to look |
|---|---|
| Recent logins | The last and lastb commands, and your SSH authentication log |
| Who is logged in now | The who or w commands |
| User accounts | /etc/passwd — look for unfamiliar users and any extra account with UID 0 |
| SSH keys | Each user's ~/.ssh/authorized_keys file |
| Scheduled tasks | crontab -l for each user, plus system cron directories |
| Listening services | ss -tulpn to see which ports are open and which processes own them |
| Running processes | top or ps aux, looking for heavy or oddly named processes |
| Mail queue | Your mail server's queue tool, checking for bulk unexpected messages |
A word of caution: if a server is genuinely compromised, the tools on it can't be fully trusted. Sophisticated attackers sometimes replace system utilities so that their own processes and files stay hidden. A clean result from these checks is reassuring, but it isn't proof.
What to do if you find something
It's tempting to start deleting suspicious files immediately. Resist that urge for a moment. A calm, ordered response gives you a much better chance of understanding what happened and stopping it happening again.
- Contain it. If you can, restrict the server's network access to stop further damage, such as spam going out or data leaving.
- Preserve evidence. Take copies of logs and suspicious files before you change anything. You'll need them to work out how the attacker got in.
- Change credentials from a clean machine. Reset passwords for the server, control panel, databases and any related accounts, and remove unknown SSH keys. Don't do this from a device you suspect may also be affected.
- Find the entry point. Was it a weak password, an outdated plugin, an exposed admin interface or an unpatched service? If you don't find and fix the cause, the attacker can simply walk back in.
- Rebuild where necessary. For a serious compromise, restoring from a known-good backup or rebuilding the server is often safer than trying to clean it in place.
- Harden and patch. Update software, close services you don't need, tighten permissions and review firewall rules.
Prevention is easier than clean-up
Many compromises come down to the same handful of causes: outdated software, weak or reused passwords, services exposed to the internet that don't need to be, and misconfigurations nobody spotted. Some sensible habits help a lot:
- Keep the operating system and every installed application up to date.
- Use SSH keys rather than passwords, and disable direct root login.
- Only expose the ports and services you actually use.
- Keep regular, tested backups stored away from the server.
- Review logs and accounts periodically, not just when something breaks.
Your website deserves the same attention as the server underneath it. Web applications bring their own risks, such as injection flaws, cross-site scripting and weak authentication. Transcom's Website Penetration Testing is a manual ethical-hacking assessment that checks for these issues and comes with an executive summary and a detailed technical report.
When to get a professional audit
If you've spotted warning signs, can't rule out a compromise, or simply want assurance that a server is properly locked down, a full audit is worth considering. It's also useful when you've inherited a server from someone else and don't know its history.
Transcom's Server Security Analysis is a full security audit of your Linux server, covering email services, DNS, FTP, HTTP/HTTPS and TLS configuration, control panels, MySQL and other database services, and all other provisioned services. It looks for:
- Traces of unauthorised access and signs of prior compromise.
- Misconfigurations, weak permissions and exposed services.
- Outdated or unpatched software across the stack.
- Access-control, firewall and hardening gaps.
You receive two reports by email covering the findings across every service audited and setting out what needs to be done. The audit is thorough and requires 7 days to complete, and costs £245 +VAT as a one-off.
If the trouble started with a suspicious or abusive email rather than the server itself, the Email Forensic Report traces a message's routing hops, checks SPF, DKIM and DMARC results and identifies spoofing techniques used to disguise the real sender.
Get your server checked
If something about your server doesn't feel right, or you'd just like to know where you stand, take a look at Server Security Analysis for a full audit of every service on your Linux server.