Secure a new VPS: users, keys and firewall

Create a normal user, switch to key login and allow only the ports you need.

Advanced 12 Oct 2026 1 min read Onimhost Support Team 0 views

Create an admin user

adduser deploy
usermod -aG sudo deploy

Use an SSH key

  1. On your computer run ssh-keygen -t ed25519.
  2. Copy the key with ssh-copy-id deploy@YOUR.SERVER.IP.
  3. Test the login in a new window before the next step.

Close the door

Set PasswordAuthentication no and PermitRootLogin no in /etc/ssh/sshd_config, then restart SSH. Next enable the firewall:

ufw allow OpenSSH
ufw allow 80,443/tcp
ufw enable

Important: Keep one SSH session open while you test, so a typo does not lock you out.

Share

Get Exclusive Offers & Promotions!

Stay updated with the latest deals, discounts, and special promotions.

Check Promotions

Chat with us