Wednesday 2 May 2018

How to disable remote SSH login for the root user



By default the root access is enabled for outside world. For security reason it’s not a good idea because any cracker can attempt to brute force your root password and potentially get access to your system if they can figure out your password.
It’s much better to disabling the root user and allowing another regular user with root user’s permissions.

Before disabling the root user create a regular user with sudo privilege to access the server remotely.

To disable root login, open the ssh configuration file /etc/ssh/sshd_config.

[root@linuxcnf ~]# vi /etc/ssh/sshd_config

Search the following line in the file:

#PermitRootLogin no

Uncomment the line as below:

PermitRootLogin no

Restart the SSH service to reflect the changes:

[root@linuxcnf ~]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@linuxcnf ~]#

Now nobody can login directory using root user!!!

No comments:

Post a Comment