Site icon ITSmartTricks.com

How to Enable and Disable Root Login in Ubuntu Linux

Disable Root Login

Disable Root Login

The default root password is not set in the Ubuntu Desktop and therefore you do not have the facility of logging in as root. This does not mean that the original root account does not exist in Ubuntu or cannot be fully accessed. Here we are given the ability to execute tasks with superuser privileges using the sudo command. practically Ubuntu developers have decided to disable root account by default. The root account which has given the password does not match the encrypted value, it can not directly login itself.

Note: The root account does not need to be enabled in the Ubuntu system because you do not call it the root account for many activities in Ubuntu Linux.

Also Read – How To Force Users To Change Their Linux LDAP Password.

Follow The Below Steps to Enable and Disable Root Login in Ubuntu Linux:

For instance, to get root privileges, the sudo command is used in the Ubuntu system. For this purpose or for another reason, you can act as a root in the Ubuntu terminal. Or you can enable or disable root account log in Ubuntu in the following ways.

How to Enable Root Login Account in Ubuntu Linux?

To enable access to the root Login user account, enter the following command and enter your user password.

itsmarttricks@mangesh:~$ sudo -i
[sudo] password for itsmarttricks:
root@mangesh:~# ls
root@mangesh:~# id
uid=0(root) gid=0(root) groups=0(root)

Now you can confirm that by entering whoami command you can see that you have enabled Access to the root user account.

root@mangesh:~# whoami
root

Also Read – How To Reset Forgotten Kali Linux Root Password.

How to Change Root Login Password in Ubuntu Linux?

Now, to change the root password here, enter the following command.

itsmarttricks@mangesh:~$ sudo passwd root
[sudo] password for itsmarttricks:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Also Read – Step By Step Change Root Password In Kali Linux

How to Disable Root Login Access in Ubuntu Linux?

If you want to disable root account login in your Ubuntu system then expire the password by entering the following command.

itsmarttricks@mangesh:~$ sudo passwd -l root
passwd: password expiry information changed.

Also Read – Top Basic Linux Commands for Beginners.

That’s all, In this article, we have explained How to Enable and Disable Root Login in Ubuntu Linux. If you like this article, then just share it and then do subscribe to email alerts for Linux, Windows, macOS, Android, Internet, Firewall and Security, CCTV tutorials. If you have any questions or doubts about this article, please comment.

Share this:
Exit mobile version