When you purchase a new RivinCloud VPS, it comes with an initial password for the root user. While convenient, leaving your server configured this way exposes it to brute-force attacks.
Securing SSH is the first and most critical step in server administration.
1. Use SSH Keys Instead of Passwords
Passwords can be guessed. Cryptographic SSH keys cannot be practically brute-forced.
Generate a key pair on your local computer:
ssh-keygen -t ed25519 -C "your_email@example.com"
Then, copy the public key to your server:
ssh-copy-id root@your_server_ip
2. Disable Root Password Login
Once you've confirmed you can log in using your SSH key, you should disable password authentication.
Open the SSH configuration file:
nano /etc/ssh/sshd_config
Find the following lines and change them:
PermitRootLogin prohibit-password
PasswordAuthentication no
Restart the SSH service to apply the changes:
systemctl restart sshd
[!WARNING] Do NOT disable password authentication before you have successfully tested your SSH key login. If you do, you will lock yourself out of your server!
3. Change the Default SSH Port
Automated bots constantly scan the internet for servers with port 22 open. Changing the port stops the vast majority of these automated attacks.
In /etc/ssh/sshd_config, change:
Port 2222
[!TIP] If you change your SSH port, make sure to allow the new port through your firewall (e.g., UFW) before restarting the SSH service!
By implementing these three steps on your RivinCloud VPS, you drastically reduce your attack surface and keep your data safe.