1. Key instead of password
Create an ED25519 key locally and copy the public key to the server. Then disable password login. Test key login in a second session before closing the old one.
ssh-keygen -t ed25519 -a 100 -C "[email protected]" ssh-copy-id -i ~/.ssh/id_ed25519.pub [email protected] # On the server: sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config sudo sshd -t && sudo systemctl reload ssh
Note: Open a second SSH session and test key login before closing the first. Otherwise you risk a lockout.