Skip to Content

Enable SSH Key based authentication and Disable Password Authentication in ssh

how to setup SSH key authentication and turn off password login


Overview: This article outlines how to secure SSH by enabling key-based authentication and disabling password login via the sshd configuration file.


Hardening Authentication in SSH

Step 1: Enable SSH Key based authentication and disable Password Authentication in sshd configuration file.

roo@gateway:~# vi /etc/ssh/sshd_config

PubkeyAuthentication yes

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

PasswordAuthentication no

Step 2: After making changes in the SSHD configuration file save it and restart SSHD

root@gateway:~# systemctl restart sshd


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?