Root Server Security: The Most Important Immediate Measures
Learn how to strengthen the security of your root server with targeted measures and protect it against attacks.
Learn how to strengthen the security of your root server with targeted measures and protect it against attacks.
In short: root server security rests on three pillars. Secure access, reduce the attack surface, automate patches. Pulling these three levers blocks most of the automated attacks that run against open ports every day.
The exact order:
PermitRootLogin no, no more password login.Pro tip: Before every firewall or SSH change, open a second terminal session to the server. If the first one drops, you can roll back immediately through the second one without having to wait for the emergency console.
You will find the complete checklist with all commands further down in the article.
Root server security comes from combining SSH hardening, a default-deny firewall, automatic updates, and a working emergency console, not from a single measure.
| Topic | Details |
|---|---|
| Prioritize SSH access | Keys instead of passwords, PermitRootLogin no, because SSH remains the most common attack vector. |
| Set the firewall to default deny | Open only the ports you need and throttle brute-force attempts with ufw limit. |
| Test emergency access beforehand | Check the out-of-band console before changing SSH or firewall rules. |
| Automate hardening | Use CIS Benchmarks and OpenSCAP to detect configuration drift regularly. |
| Choose suitable infrastructure | Nexthosting provides DDoS protection, snapshots, and a German server location as a foundation for hardened setups. |
Root server security does not start with the firewall, but with the first login after provisioning. Cut corners here and you build in weaknesses that are hard to spot later.
adduser, add it to the sudo group, and install your SSH key before you lock root access.Pro tip: Test the emergency console right after provisioning, not only when you need it. Many admins only realize during a lockout that access was never enabled.
If you run FiveM, Minecraft, or Garry’s Mod servers, follow these steps just as consistently for Rust server instances and other game server deployments, since game servers often come with additional open ports for voice chat or query protocols.
SSH is the most common attack vector on Linux servers because it is almost always open and publicly reachable. Hardening it takes the easiest attack surface away from automated bots.
ssh-keygen -t ed25519) instead of RSA. It is shorter, faster, and at least as secure.PasswordAuthentication no in /etc/ssh/sshd_config as soon as the key works.PermitRootLogin no and work exclusively through the admin user with sudo.AllowUsers or AllowGroups instead of leaving SSH reachable for everyone.One firm rule applies before restarting the SSH service: keep a second session open, run sshd -t to check the syntax, and only then run systemctl reload sshd. That way you avoid locking yourself out.
Pro tip: Save a working sshd_config as a backup before you change it. A single typo in the configuration file is enough to block the service completely.
A firewall based on the default-deny principle blocks all incoming traffic by default and opens only explicitly allowed ports. That is the difference between a firewall that actually protects and one that only serves as an alibi.
ufw limit ssh to automatically throttle connection attempts that occur too frequently in a short time.nftables ruleset is worthwhile instead of the simpler ufw interface.For dedicated servers running several services, a clear separation between publicly reachable ports and purely internal connections, for example between the web server and the database, is worthwhile.
fail2ban reads log files such as /var/log/auth.log and automatically bans IP addresses that send incorrect credentials too often. For sshd, a short jail configuration with bantime, findtime, and maxretry is usually enough to stop brute-force attempts within seconds.
ufw limit and fail2ban complement each other but do not replace each other: ufw throttles connection rates, while fail2ban bans specifically after failed logins.Pro tip: Increase the bantime progressively for repeat offenders. A bot that comes back after the third ban often gets a significantly longer ban time right away with the CrowdSec approach.
Unpatched software remains one of the most common entry points on root servers because exploits for known vulnerabilities are often publicly available within hours.
unattended-upgrades on Debian/Ubuntu or dnf-automatic on RHEL-based systems so that security patches are applied automatically.The BSI module SYS.1.3 lists concrete requirements for kernel parameters, account management, and auditing for Linux servers. These requirements are not bureaucratic paperwork but a solid technical foundation.
rp_filter for anti-spoofing, disable ICMP redirects, and turn on fs.protected_hardlinks and fs.protected_symlinks.Pro tip: Never enable SELinux or AppArmor directly in enforcing mode on a production system. A single misconfigured service can otherwise block the entire server operation.
Every running service that nobody needs is an open door without a handle on the outside. Less attack surface means less maintenance effort and less risk at the same time.
ss -tulpn and uninstall services that nobody actively uses.127.0.0.1, never to the public interface.umask, especially for configuration files containing credentials.An attacker who can delete local logs leaves no traces. That is exactly why logging belongs off the machine, not just on the local disk.
auditd and define rules for sudo calls, identity changes, and the loading of kernel modules./etc/passwd) and keep a simple response playbook ready.A backup that has never been tested is at best a guess. Root server security does not end with defense; it includes the ability to get back online after an incident.
sshd -t for the SSH syntax, ufw status for the active firewall rules.According to practical 15-minute checklists, the most important steps can be completed in a short time if you stick to the order.
adduser admin && usermod -aG sudo admin.PermitRootLogin no, PasswordAuthentication no in /etc/ssh/sshd_config, then sshd -t && systemctl reload sshd.ufw default deny incoming, ufw allow OpenSSH, ufw limit ssh, ufw enable (Debian/Ubuntu) or the equivalent firewall-cmd on the RHEL family.apt install fail2ban or dnf install fail2ban, and enable the default jail for sshd.apt install unattended-upgrades or dnf install dnf-automatic.auditd, initialize the AIDE database.Important here: leave a test session open, check the console beforehand, and verify each step individually instead of pushing everything through in one go.
A hardened SSH access protects nothing if the web application running on top of it is itself the open flank. Anyone running WordPress, a custom PHP backend, or a database on a root server needs an additional layer of protection directly at the application level.
A web application firewall filters HTTP requests for known attack patterns such as SQL injection or cross-site scripting before they even reach the application. For nginx-based setups, ModSecurity with the OWASP Core Rule Set is a solid foundation without having to write custom rules from scratch. It is important to run the rules in detection mode at first, because an overly aggressive ruleset quickly blocks legitimate requests too, for example with complex API calls.
For databases, one simple but often ignored rule applies: MySQL, PostgreSQL, or MongoDB should generally listen only on 127.0.0.1, never on the public network interface. If an application on another server needs access, an SSH tunnel or a VPN belongs in between, not an open database port with password authentication on the internet.
It is also worth taking a look at the application layer itself: prepared statements against SQL injection, current framework versions, and a separate database user per application with exactly the privileges it needs. A CMS admin area should additionally be restricted via the firewall to known IP ranges if that is practical in operation. This combination of WAF, bind addresses, and minimal database privileges reduces the attack surface considerably without having to rebuild the application itself.
A single root server that serves the web server, database, and internal management tools at the same time is a single point of failure. Network segmentation separates these roles logically, even if they run on the same machine physically.
At the level of virtual machines or containers, this can be implemented with separate bridges: a public network for the web server and an internal network for the database and cache that is not reachable from the outside at all. If you operate several physical or virtual servers, you can additionally use VLANs to keep management traffic, application traffic, and backup traffic on separate logical networks. An attacker who compromises a web application then does not automatically end up in the management network.
For operators of several game servers, for example FiveM instances with multiple resources and a database connection, this means in concrete terms: the game server process, the database, and any voice server components should not sit on the same open ports in the same network segment indiscriminately. A clean separation between query port, game port, and management access limits the damage if one component is compromised.
Balance matters here: not every small server needs a full VLAN architecture. For a single VPS with one application, the combination of firewall rules and bind addresses from the previous sections is often entirely sufficient. Segmentation only becomes relevant when several services with different protection requirements run on shared infrastructure, for example with multiple customer projects on one dedicated server.
Root server security does not end at the network boundary. Anyone with physical access to a machine can theoretically bypass any software lock, for example by booting from external media.
For rented servers in a professional data center, physical security is largely the provider's responsibility, but admins should know what matters: access control to the data center, video surveillance, and a clear separation between customer areas. A German server location brings the practical advantage that the physical infrastructure is subject to the same strict requirements as other critical IT sites in the country.
On the software side, physical access can be made harder as well. Disk encryption with LUKS protects data if someone gets physical access to the storage media, with the caveat that the decryption passphrase has to be entered on reboot, which can become a problem for remote servers without out-of-band access. A BIOS or UEFI password prevents someone from manipulating the boot order and booting from a USB stick.
Hardware security modules, or HSMs, come into play when cryptographic keys are especially worth protecting, for example at certificate authorities or in payment processing. An HSM stores private keys in dedicated, tamper-resistant hardware and never releases them in plain text, even if the rest of the system is compromised. For most root servers with web or game server workloads, however, a dedicated HSM is clearly oversized. It becomes more relevant with your own certification infrastructure or when legal requirements demand a particularly high protection level for key material.
A hardened server is of little use if a flood of requests simply clogs the network connection long before the firewall can even take effect. DDoS attacks target exactly this point: not a vulnerability in the system, but the plain capacity limit of the line.
Some basic measures can be implemented at the server level. Enable SYN cookies in the kernel to cushion SYN flood attacks, set connection limits per IP via the firewall, and apply rate limiting at the application level for public endpoints such as login forms or API routes. These measures help against smaller, targeted attacks but quickly reach their limits once an attack exceeds the actual bandwidth of the connection.
Against volumetric attacks that generate several gigabits per second of traffic, only upstream infrastructure that absorbs the attack traffic before it reaches the actual server helps. That is exactly why DDoS protection at the network level has to start with the hosting provider itself, not only on the rented server. If you run game servers for titles such as Rust or DayZ, you know the problem from experience: because of their public reachability and sometimes rival player groups, these community servers are a popular target for deliberate overload attacks.
When choosing a hosting provider, it is therefore worth checking closely whether DDoS protection is built into the network infrastructure from the start rather than sold as a later add-on. A server that is only rerouted manually after an attack has begun has often already produced downtime in the first few minutes that cannot be undone.
Hardening is a snapshot in time, not an end state. New software versions, changed configurations, and newly discovered vulnerabilities constantly shift a server's security posture, which is why regular reviews are just as important as the initial hardening.
A penetration test simulates a real attack, either from the outside against publicly reachable services or from the inside, to check how far an attacker gets after initial access. For smaller setups, automated vulnerability scanning with tools such as OpenVAS is often enough to find known vulnerabilities in installed software before a real attacker does. Larger infrastructures with several critical services benefit from a manual penetration test by external specialists, because automated scanners usually miss logic flaws in custom application logic.
Between the larger tests, automated auditing against recognized baselines is part of day-to-day operations. OpenSCAP can be configured against CIS Benchmarks and automatically reports when a configuration deviates from the defined security baseline, for example because an update reset a setting. This kind of configuration drift is one of the most common reasons why a once-hardened server shows gaps again months later without anyone noticing.
A realistic cadence for most operators: automated scans weekly or monthly, and a more in-depth manual test at least once a year or after major infrastructure changes. Documentation matters here too: every finding needs a clear owner and a deadline for remediation, otherwise test results disappear unused into a drawer.
The most common security incidents on root servers are not caused by sophisticated attacks but by simple omissions: no snapshot before the change, no tested out-of-band console, an SSH reload without a second open session. These mistakes repeat across the industry because hardening is often treated as a one-time to-do instead of a fixed part of provisioning.
That is why Nexthosting provides DDoS protection, automatic snapshots, and server locations in Germany as standard equipment, not as an optional extra. Anyone who integrates hardening directly into provisioning, for example through automated images or Ansible roles, avoids exactly these recurring operational mistakes.
— Erik
If you want to apply the checklist from this article on a rented server, you need a platform with a solid network connection and a server location in Germany as a foundation. Nexthosting offers VPS and dedicated server solutions with DDoS protection, NVMe storage, and automatic backups as a starting point on which the hardening described here can be applied directly, instead of solving additional infrastructure problems before you even get to SSH configuration.
For admins looking for a self-managed server with full root access, the VPS Einfach plan is a good entry point, with an upgrade option to VPS Standard as resource needs grow. Game server operators who want a ready-made setup for titles such as Garry’s Mod or CS2 in addition to the bare infrastructure will find preconfigured environments there that can be further secured with the measures from this article. If you are also planning a web presence for your project or community, you can get additional advice on the frontend setup from Rheinmarketing. Take a look at the matching product category and start with a server that stands on a solid foundation from day one.
Linux is not an automatically secure system. It is a platform with strong protection mechanisms that have to be configured actively. Without SSH hardening, a firewall, and updates, even a Linux server remains vulnerable.
A root server is a physical or virtual machine on which the tenant has full administrative access with root privileges and is responsible for configuration, security, and maintenance. This control is exactly what makes root server security the operator's sole responsibility.
A DNS server is only as secure as its configuration: without access restrictions, rate limiting, and up-to-date software, it becomes a target for cache poisoning or amplification attacks. The same hardening principles as firewall rules and automatic updates apply here just as they do to the rest of the server.
A root server is suited for web hosting, databases, game servers such as FiveM or Minecraft, and custom development environments with full access to the operating system. That flexibility also comes with full responsibility for root server security policies, since no provider takes over the server configuration for the tenant.