How to secure your VPS (firewall, SSH keys)

What this solves

A new VPS is reachable on the public internet. These steps harden SSH and the host firewall without locking you out of iHoster24 management tools.

Firewall

Allow SSH (and HTTP/HTTPS if you host websites) before enabling the firewall.

Ubuntu/Debian (UFW):

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

AlmaLinux/Rocky (firewalld):

firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

Advanced users can use iptables / nftables directly — same idea: never block port 22 until an alternate access path works.

SSH keys

On your PC: ssh-keygen -t ed25519. Copy the public key: ssh-copy-id root@YOUR_VPS_IP. Confirm key login works, then set PasswordAuthentication no in /etc/ssh/sshd_config and restart sshd.

Optional: disable root password login

Create a sudo user with your key, test login, then set PermitRootLogin prohibit-password (or no if you only use the sudo user).

Warning: Keep a Client Area session open and test the VNC console before disabling passwords. If SSH breaks, console is your recovery path.

When to contact support

If you’re locked out of SSH and console, open a ticket — we can help with rescue steps.

Related articles

Need help?

Open a support ticket and we'll assist you.

Open Support Ticket