Enable Account root in Ubuntu

Assign a password to your root user from your current session from a terminal:

sudo passwd root

Enable login from the graphical interface with the following command:

sudo gedit /etc/gdm3/custom.conf

When you open the configuration file, locate the [security] line, and then type the following below it:

[security]
AllowRoot=true

Edit the gdm-password file with the following statement:

sudo gedit /etc/pam.d/gdm-password

In the dgm-password file, locate auth required pam_succeed_if.so user != root quiet_success and add the # symbol as shown below:

# auth    required    pam_succeed_if.so user != root quiet_success

Edit the .profile file:

sudo gedit /root/.profile

In the .profile file locate the mesag n line || True and replace it with the following:

if `tty -s`; then    
  mesg n 
fi

Log out of the current session and log in with the root user.