By default, both root login and the root account are usually locked on the server due to security concerns. However, sometimes it may be necessary to have the root user account enabled and the ablility to directly login onto the server. For that, follow the steps below:-
Step 1: By default, the root account password is locked in Ubuntu. So unlock it first:-
sudo -i
sudo passwd root
Step 2: Change the SSH config details as follows:-
PermitRootLogin no
PermitRootLogin yes
Step 3: Specify Which Accounts Can Use SSH
Find out if the sshd_config file has an entry as below and if there is such an entry then remove the root user from below
DenyUsers root user1 user2
Or
If there is no DenyUsers entry then place in it an entry like below:-
AllowUsers root
Save the file and restart SSH service using the command below:-
/etc/init.d/ssh restart
That’s it. After this, you will be able to login directly using root credentials.
]]>