Configure SSH Key Login
- Generate a key pair using the command
ssh-keygenor use an existing key pair - Copy the corresponding public key to the
root/.ssh/authorized_keysfile.
Disable password login
Edit the /etc/ssh/sshd_config file and modify the following parameters:
PubkeyAuthentication yes
PasswordAuthentication no
Restart the SSH Service
sudo systemctl restart sshd
If it does not take effect, delete all files in etc/ssh/sshd_config.d.