A new VPS is reachable from the whole internet the moment it boots, and automated scanners start trying SSH and RDP passwords within minutes. The good news is that a handful of well-chosen steps stop almost all of that. This guide is a checklist you can work through in your first hour, with separate sections for Linux (Ubuntu, Debian, AlmaLinux) and Windows Server, followed by backups, log checks and how to recover if you lock yourself out.
Who is responsible for what
Security on a VPS is shared. The provider protects the platform and the network: physical security, the hypervisor, and — at Hostigan — always-on upstream DDoS filtering that absorbs floods of traffic before they reach your server.
Everything inside the virtual machine is yours: the operating system, user accounts, the firewall, the software you install and its updates, and your backups. DDoS filtering does nothing against a guessed password or an outdated WordPress plugin. What is a DDoS attack? explains the difference in more detail.
The first-hour checklist
Whatever the operating system, do these in order:
- Log in and change the initial password to a long, unique passphrase.
- Install all updates and reboot if needed.
- Create a personal admin account instead of using root or Administrator day to day.
- Tighten logins — SSH keys on Linux, restricted RDP on Windows.
- Enable the firewall and open only the ports you actually use.
- Take a snapshot or backup of the clean, secured state.
- Test a fresh login in a new window while your current session stays open, and find the console in the client area so you know where it is before you need it.
Tip: Make one change at a time and test it. A checklist done in a hurry is the most common way to lock yourself out.
Securing a Linux VPS
Updates
sudo apt update && sudo apt full-upgrade -y # Ubuntu / Debian
sudo dnf upgrade -y # AlmaLinux / Rocky Linux
Then turn on automatic security updates so patches don't wait for you:
sudo apt install unattended-upgrades # Ubuntu / Debian
sudo dpkg-reconfigure -plow unattended-upgrades
sudo dnf install dnf-automatic # AlmaLinux / Rocky Linux
sudo systemctl enable --now dnf-automatic-install.timer
Ubuntu and Debian create /var/run/reboot-required when a reboot is needed; on AlmaLinux, sudo dnf needs-restarting -r tells you. How to update your Ubuntu server covers updates in more depth.
A personal user and SSH keys
Create a sudo user and install your SSH key for it, as shown in How to connect to a Linux VPS with SSH. Once key login works, switch off passwords and direct root login. Put the settings in a drop-in file whose name sorts first, because SSH uses the first value it finds:
sudo nano /etc/ssh/sshd_config.d/00-hardening.conf
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
Validate the configuration before applying it, then reload:
sudo sshd -t && sudo systemctl reload ssh # Ubuntu / Debian
sudo sshd -t && sudo systemctl reload sshd # AlmaLinux / Rocky Linux
Confirm the result with sudo sshd -T | grep -Ei 'permitrootlogin|passwordauthentication', and test a new login before closing your session. How to secure SSH on your Linux server goes further.
Firewall
On Ubuntu and Debian, UFW is the simplest option:
sudo apt install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw allow 80,443/tcp
sudo ufw enable
sudo ufw status verbose
AlmaLinux and Rocky Linux use firewalld, which is active by default:
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
Warning: Always allow SSH before enabling the firewall. If you changed the SSH port, allow that port instead. More examples are in How to configure a firewall on your Linux VPS.
Fail2ban
Fail2ban blocks IP addresses after repeated failed logins. Install it (on AlmaLinux it comes from the EPEL repository) and create /etc/fail2ban/jail.local:
[DEFAULT]
bantime = 1h
findtime = 10m
maxretry = 5
ignoreip = 127.0.0.1/8 ::1 YOUR_OWN_STATIC_IP
[sshd]
enabled = true
backend = systemd
sudo systemctl enable --now fail2ban
sudo fail2ban-client status sshd
The backend = systemd line matters on Debian 12, which logs to the systemd journal instead of /var/log/auth.log.
Close what you don't use
List everything that listens for connections and remove or disable what you don't need:
sudo ss -tulpn
sudo systemctl disable --now SERVICE_NAME
A database should normally listen only on 127.0.0.1, not on the public IP.
Keep your applications patched too
Operating system updates don't cover everything. WordPress core, themes and plugins, Composer and npm packages, and Docker images all need their own updates, and outdated web applications are a far more common way in than the operating system itself. Remove plugins and test sites you no longer use, pull fresh container images regularly with docker compose pull, and subscribe to the security announcements for the software you depend on.
Securing a Windows Server VPS
- Updates. Install everything in Windows Update, then set a fixed maintenance window for updates and restarts so they don't happen at the worst moment.
- Accounts. Create a personal administrator account with a strong password, then disable or rename the built-in Administrator account.
- Remote Desktop. Keep Network Level Authentication (NLA) switched on and restrict the Remote Desktop firewall rule to the IP addresses you connect from:
Set-NetFirewallRule -DisplayGroup "Remote Desktop" -RemoteAddress "YOUR_OWN_STATIC_IP"
- Account lockout. Set a lockout policy (for example, lock for 15 minutes after 10 failed attempts) under Local Security Policy → Account Policies.
- Microsoft Defender. Check that real-time protection is on and definitions are current with
Get-MpComputerStatus.
Note: Test each change separately. Hardening scripts that disable services in bulk are a classic cause of RDP lockouts. How to secure Windows Server covers each step in detail.
Backups: two places, tested
- Snapshots let you roll back the whole disk after a failed change. On Hostigan they are included on VPS Plus and higher.
- An off-server copy protects you if the VPS itself is lost or compromised. Automate it with
rsync,resticorborgto storage somewhere else, and encrypt it. - Test a restore now and then. A backup you have never restored is a hope, not a backup.
- Before a reinstall, back up everything — a reinstall erases the disk.
Keep an eye on the logs
- Linux:
sudo journalctl -u ssh --since today(-u sshdon AlmaLinux) shows SSH logins;last -n 20lists recent logins;sudo fail2ban-client status sshdshows banned addresses. - Windows: in Event Viewer → Windows Logs → Security, event ID 4625 is a failed logon and 4624 a successful one.
- Graphs: unexplained CPU use, memory pressure or outgoing traffic can be the first sign of a compromise.
When you lock yourself out
| Problem | Fix |
|---|---|
| SSH change locks you out | Log in via the console, fix the file in /etc/ssh/sshd_config.d/, run sshd -t, reload |
| Firewall blocks you | Console → sudo ufw allow OpenSSH or sudo firewall-cmd --add-service=ssh --permanent and reload |
| Fail2ban bans your IP | sudo fail2ban-client set sshd unbanip YOUR_IP, then add it to ignoreip |
| Update breaks a service | Read journalctl -u SERVICE, fix the setting, or roll back to a snapshot |
In short
Update the system and keep it updated automatically, work as a personal admin user, use SSH keys or a restricted RDP rule, run a deny-by-default firewall with Fail2ban, keep backups in two places, and glance at the logs regularly. Make one change at a time, and always know where the console is.
Security on a Hostigan VPS
Every Hostigan VPS includes always-on upstream DDoS filtering, full root access and console access through the client area at client.hostigan.com, so you can recover even if a firewall rule goes wrong.
Frequently asked questions
No. DDoS filtering keeps floods of traffic from knocking your server offline, but it does not stop someone guessing a password, exploiting an outdated plugin or using a service you left open. Server security is still your job.