How to enable root user login in ubuntu 18.04 version

Hi

I am new to ubuntu, i updated from 16.04 version 18.04 sucessfully.
I am not able to login with root user.
please suggest me how login as root user.

Hello,

Welcome to our forums.

There is no default password for root user on ubuntu.

I’m not sure if you set the root password previously or what happened during the upgrade, but you can set/enable root user password on Ubuntu system by executing the following command:

$ sudo passwd

Given that your user is administrator and you posses a valid password the above command will set a new root password.

Once done, you can gain root shell by executing su command and typing a new root password:

$ su

For more information read our How to set a root password on Ubuntu 18.04 Bionic Beaver Linux guide.

Please note that you should be able to execute any command with root privileges by using sudo command, thus normally, there is no need to access root shell.

In case you lost your user ( sudo ) password as well as root password follow our guide on How to reset lost root password on Ubuntu 18.04 Bionic Beaver Linux.

Hope this helps…

Lubos

1 Like

You can also use
sudo -i
then enter your password
The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell. This means that login-specific resource files such as .profile or .login will be read by the shell

also you can change settings by going to:

/etc/sudoers
List of who can run what

/etc/environment
Initial environment for -i mode on Linux

You can also view how to configure sudo here:
www.sudo.ws/man/1.8.25/sudo.conf.man.html

hope this helps
:grinning: