VPS servers are often targeted by automated bots. On Linux servers, these bots typically scan for the SSH port (usually port 22) and attempt to gain root access via brute-force attacks.
To improve your server's security, it's highly recommended that you change the default SSH port and disable root login via SSH. This setting is applied automatically if you're using DirectAdmin, Plesk, or cPanel, but you can also configure it manually by following this guide.
Below is a step-by-step guide on how to do it:
Access your VPS via SSH as root:
ssh root@your-server-ip
Run the following command to edit the sshd_config file:
sudo nano /etc/ssh/sshd_config
Inside the file, locate the # Authentication section and change or add the following line:
PermitRootLogin no
To save the changes:
Apply the changes by restarting the SSH service:
sudo systemctl restart ssh
Important: If you’re already disconnected from root, make sure you’ve created a non-root user with sudo access to log back in.
As an extra security step, you might also consider changing the default SSH port or creating a new user with sudo privileges. Let me know if you’d like guides for those too.
Contact our experts, they will be happy to help!
Contact us