Skip to Content

How to enable Public key based authentication and Allow root login in SSHD

Enabling Key-Based Authentication and Root Login in SSH


Overview: This guide outlines the steps to enable key-based authentication and allow root login in SSH for improved security and administrative access.


Step 1: Open the SSH configuration file using a text editor.

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

Step 2: Locate the PubKeyAuthentication and PermitRootLogin parameters in the configuration file.

Step 3: Set it to 'yes'.

PubkeyAuthentication yes

PermitRootLogin yes

Step 4. Restart the ssh daemon so that the new settings come into effect. 

root@gateway:~# service sshd restart

Related Articles:

Configurations to be enabled in sshd configuration.
Why Key-Authorization is not working?
Add ssh public key for passwordless authentication.