Secure a new Cloud VPS in 10 minutes
Updated 27 Nov 2026
A new server on the internet gets password-guessing attempts within minutes. These steps stop nearly all of them. They're written for Ubuntu and Debian. Run them as root after connecting with SSH.
1. Install updates
apt update && apt upgrade -y
Then turn on automatic security updates:
apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
Answer Yes.
2. Create your own user
Working as root all the time is risky. Create a user (replace asha with your name) and give it admin rights:
adduser asha
usermod -aG sudo asha
3. Use an SSH key instead of a password
On your own computer (not the server), make a key if you don't have one:
ssh-keygen -t ed25519
Press Enter at each question. Then copy it to the server:
ssh-copy-id asha@102.214.10.25
On Windows, where ssh-copy-id isn't available, run this in PowerShell instead:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh asha@102.214.10.25 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Test it: ssh asha@102.214.10.25 should sign you in without asking for the server password.
4. Turn off password and root sign-in
Only do this after step 3 works, or you'll lock yourself out.
sudo nano /etc/ssh/sshd_config
Set these lines (remove any # in front):
PermitRootLogin no
PasswordAuthentication no
Save with Ctrl+O, Enter, Ctrl+X, then restart SSH:
sudo systemctl restart ssh
5. Turn on the firewall
Allow SSH and websites, block the rest:
sudo ufw allow OpenSSH
sudo ufw allow 80,443/tcp
sudo ufw enable
6. Block password guessers
sudo apt install -y fail2ban
It works with sensible defaults straight away. It bans an IP for 10 minutes after repeated failed sign-ins.
Done
Your server now updates itself, only accepts your key, and shows only the ports you chose. Keep your private key safe. Losing it means using Reset root password in the portal and re-enabling password sign-in.
Need a server? Order a Cloud VPS and get root access within minutes. For help, open a ticket and choose Technical.