Linux/Unix:How To Disable SSH Login For Root User

For security purposes, we should disable remote SSH login as root user,  you know root user is super administrator in linux operating system, so we shoud not allow remote ssh login with root user, if you are familar with Ubuntu system, the defalut setting of system has disable root user. so you’ll see how to prevent root user to login systme via SSH service in linux.

​Disable SSH Login For Root User


you can modify the /etc/ssh/ssd_config configuration to change  the value of “PermitRootLogin” field to “no”,  see below:

PermitRootLogin no

Then, restart the sshd service using the following command:

[root@devops ~] /etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]

Last, you can login the system with root user via ssh client.

done…

You might also like:

Sidebar



back to top