Site icon New Generation Enterprise Linux

How to restrict direct root user password login on Linux ?

In this post, we will see how to restrict direct root login via password, and only allow login via keys.

To achieve this, we need to change below setting in sshd_config file.

$ cat /etc/ssh/sshd_config | grep -i permitroot
#PermitRootLogin yes
PermitRootLogin prohibit-password

Here we have changed the permitrootlogin option from yes to “prohibit-password”.

After this, it will prohibit password login, and only login via keys is permitted.

0 0 votes
Article Rating
Exit mobile version