Searching...

How to disable SSH root login

To disable root login for SSH, you need to edit the configuration file /etc/ssh/sshd_config.

nano /etc/ssh/sshd_config

Find the following line and remove the # sign.

#PermitRootLogin no
PermitRootLogin no

All that remains is to restart the SSH service.

/etc/init.d/sshd restart

Now when we try to log in with Root access, we get an "Access Denied" error message.
Now after logging in as a classic user, you need to use the su command to switch to the Root user.

Comments

To submit comment you have to be logged-in