Skip to Content

Enable SSH Key based authentication and Disable Password Authentication in ssh

Set Up SSH Key Authentication and Turn Off Password Login


Overview: This article covers hardening SSH authentication by enabling SSH key-based authentication and disabling password authentication. It involves modifying the /etc/ssh/sshd_config file to set PubkeyAuthentication yes and PasswordAuthentication no, followed by restarting the SSH service to apply the changes.


Hardening Authentication in SSH

  • Enable SSH Key based authentication
  • Disable Password Authentication in sshd configuration file

root@gateway :vi /etc/ssh/sshd_config

PubkeyAuthentication yes

# To disable tunneled clear text passwords, change to no here!

PasswordAuthentication no

:wq

root@gateway : service sshd restart


Related Articles

Different types of SSH authentication keys

Enable/Disable password or key based authentication

Set SSH Key Expiry for the gateway users

Add a Linux server or a Linux instance into the Ezeelogin ssh jumphost?