How to enable root user login in ubuntu 18.04 version


#1

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.


#2

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