sudo sed -i 's/^#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
Enable SSH public key authentication
Uncomments PubkeyAuthentication to yes, allowing login with a key pair — a private key you hold and a public key stored in the account's authorized_keys file. Keys are the recommended SSH credential because they cannot be guessed like passwords. This is the prerequisite before disabling password auth.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.