SSH keys are safer and more convenient than repeated password login. Configure key login first, verify it works, and only then consider disabling password login.
Create a key pair locally
ssh-keygen -t ed25519 -C "bwg-vps"Install the public key on the VPS
ssh-copy-id root@YOUR_SERVER_IPIf ssh-copy-id is not available, paste the public key into ~/.ssh/authorized_keys manually and make sure file permissions are correct.
mkdir -p ~/.ssh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keysTest before changing SSH settings
Open a new terminal and test key login while keeping the existing session open. This gives you a recovery path if you make a configuration mistake.
ssh root@YOUR_SERVER_IPOptional hardening
After key login is confirmed, you can consider disabling password login in sshd_config and restarting sshd. Keep emergency console access in mind.