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.


  1. Open the SSH configuration file using a text editor.
  2. Locate the PubKeyAuthentication parameter in the configuration file.
  3. Set it to 'yes'.

vi /etc/ssh/sshd_config

PubkeyAuthentication yes

PermitRootLogin yes

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

:~# service sshd restart

Related Articles: