Key takeaways
- Create a sudo user and log in with SSH keys.
- Disable root and password login only after testing key login.
- Enable UFW and unattended security updates.
Do these steps as soon as you get a new server — before installing anything else.
1. Log in and update
ssh root@203.0.113.10
apt update && apt upgrade -y
2. Create a regular user
adduser deploy
usermod -aG sudo deploy
3. Set up SSH key login
On your computer, create a key if you don’t have one, then copy it to the server:
ssh-keygen -t ed25519
ssh-copy-id deploy@203.0.113.10
Log in as the new user in a new terminal to confirm it works before continuing.
4. Disable password and root login
Edit /etc/ssh/sshd_config (or add a file in /etc/ssh/sshd_config.d/):
PermitRootLogin no
PasswordAuthentication no
Then reload SSH:
sudo systemctl reload ssh
5. Enable a firewall
sudo ufw allow OpenSSH
sudo ufw enable
6. Turn on automatic security updates
sudo apt install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades
7. Set the hostname and time zone
sudo hostnamectl set-hostname web1
sudo timedatectl set-timezone Asia/Dubai
Your server is now ready for a web server, database or application.