//Question
How to disable Password Authentication in SSH?
Posted on 19th August, 2024
Evan
//Answer
To disable password authentication in SSH and enforce the use of key-based authentication, follow these steps:
Edit the SSH Configuration File:
Open the SSH configuration file using a text editor:
bash sudo nano /etc/ssh/sshd_config
Disable Password Authentication:
Locate the line:
shell #PasswordAuthentication yes
Uncomment and change it to:
perl PasswordAuthentication no
Save and Exit:
Save the file and exit the editor.
Restart the SSH Service:
Restart the SSH service to apply the changes:
sudo systemctl restart sshd
This will disable password-based authentication, requiring users to authenticate via SSH keys. Make sure your SSH key setup is complete and functioning correctly before making this change, as password authentication will no longer be available.
Comments