Here are the commands that are required to run to secure VPS server on InterServer. Run these commands one by one.
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
nano /etc/ssh/sshd_config
Remove # from PubkeyAuthentication.
PubkeyAuthentication yes
Make passwordAuthentication from YES to NO.
PasswordAuthentication no
systemctl restart ssh
