sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config

Category: VPS Management

sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config

Disable password-based SSH authentication — require keys only

Password auth is vulnerable to brute-force attacks. After adding your SSH key, disable passwords so only private key holders can log in. Confirm your key works first or you'll lock yourself out.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.