ACLClouds
ACLClouds

Secure a Linux VPS in 15 minutes

SSH key, password login disabled, ufw firewall, fail2ban and automatic updates: five steps to protect your Linux VPS.

To secure a Linux VPS in 15 minutes, install an SSH key, disable password login, open only the useful ports with ufw, add fail2ban and turn on security updates. These five steps close the doors that bots test constantly on every exposed server.

  • An SSH key replaces the password, the bots’ favourite target.
  • ufw closes everything except SSH, the web and the ports you open on purpose.
  • fail2ban temporarily blocks addresses that fail too often.
  • Security updates install without intervention with unattended-upgrades.

Create an SSH key

On your computer, generate a key pair with ssh-keygen -t ed25519. The private key stays with you, in the ~/.ssh folder. Copy the public key to the server with ssh-copy-id user@vps-address. Protect the private key with a passphrase.

  • Never copy the private key to the server or into a Git repository.
  • Test the key login in a second terminal before moving to the next step.

Disable password login

Open /etc/ssh/sshd_config with sudo nano and set PasswordAuthentication no and PermitRootLogin prohibit-password. Check the syntax with sudo sshd -t, then restart the service with sudo systemctl restart ssh.

  • Keep your current SSH session open during the test: it is your safety net.
  • A badly written file can block the connection: sshd -t prevents this trap.

Open only the useful ports

Install ufw, close incoming traffic by default and allow SSH before enabling the firewall: sudo apt install ufw, then sudo ufw default deny incoming, sudo ufw default allow outgoing and sudo ufw allow OpenSSH. Enable it with sudo ufw enable and check with sudo ufw status verbose.

  • For a website, add sudo ufw allow 80/tcp and sudo ufw allow 443/tcp.
  • If SSH does not listen on port 22, allow that port before enabling ufw.

Install fail2ban

fail2ban reads the logs and temporarily blocks addresses that fail too often. Install it with sudo apt install fail2ban, enable it with sudo systemctl enable --now fail2ban, then check the SSH protection with sudo fail2ban-client status sshd.

  • The block is temporary: an address blocked by mistake leaves the list automatically.
  • fail2ban complements the SSH key, it does not replace it.

Turn on security updates

Install automatic updates with sudo apt install unattended-upgrades, then run sudo dpkg-reconfigure -plow unattended-upgrades to enable them. Security fixes apply without intervention, and the log stays in /var/log/unattended-upgrades/.

  • An updated kernel needs a restart: schedule it for a quiet hour.
  • Check pending packages from time to time with apt list --upgradable.

Why choose ACLClouds for a Linux VPS

Each ACLClouds VPS is a KVM virtual machine with its own system, and the servers are located in France. As of 7 November 2026, the Mini plan starts at 4.99 € with 8 GB of RAM, 2 vCPU and 40 GB of storage.

  • Essentiel: 16 GB of RAM, 4 vCPU and 80 GB of storage, at 9.99 €.
  • The control panel is available in 7 languages.
  • For a Windows server, see Linux VPS or Windows RDP.

Frequently asked questions

Should I change the SSH port?

It is not enough protection on its own. Changing the port mainly reduces the noise in the logs. The SSH key and fail2ban protect much more.

What if I lock myself out after disabling passwords?

Always keep an SSH session open while you make changes. If key login fails, fix the file from that session before closing it.

Does Docker bypass the ufw firewall?

Yes, a port published by Docker can stay reachable despite ufw. Publish only the ports you need, and check from another network.