Sunday, May 31, 2020

How to Enable Root Login via SSH in Ubuntu (Enable SSH Root Access in Linux)

After installing the Linux operating system, we may want to access it via remote access or remote console. For the sack of security, we may use SSH service  to access our server. Generally, this service automatically installed during the operating system installing process, if you select this service to be installed. Otherwise, you can install it manually by using with Linux command line. To install SSH manually, please use the following link.


To access our system via remote access using SSH service, we may use any standard user or normal user for authentication. There is no limitation applied for this type user. But, if you want access as root user, your access will be denied. Because of, SSH access has been disabled for the root user by default. We must have to enable it, if we want root access via SSH. 

To enable this root access, we have to edit the "sshd_config" file. And we have to change the value to "yes" for the option "PermitRootLogin". By default, this value is "no" for this setting. The total setting will be as follows:-

PermitRootLogin yes

You can use any text editor to open this file. We are using here "vi" text editor. You will find the sshd_config file the following location:-

/etc/ssh/sshd_config

If you don't find any ssh folder under "/etc" path, then it is cleared, there is no SSH service installed in this system. 

Now I will go step by step for the whole process. First of all, we have to open "sshd_config" file. The command will be:-

vi /etc/ssh/sshd_config

Now find out the following line.

PermitRootLogin no

From here, simply change "no" to "yes". We are done. Now restart the SSH service or daemon. For that, the command will be:-

service ssh restart
 
Now you can access as root user.