How do I login as root?

Solution 1:

The su command requires you to put in root password. Root user on Ubuntu in general is locked so no user can login as root thus su is not likely to work.

For sudo -s to work you will have to be part of the admin group on an Ubuntu machine, which apparently you are not.

If you are the only user on the system that is concerning and may be quite involved to fix. If not I would suggest you talk to the System Administrator or owner of the system to see if you even can get root privileges.

Solution 2:

Be aware that the root account is not active by default.

You will need to do:

sudo passwd root

Then go ahead to set password. Use the root user using

su root

Solution 3:

The https://help.ubuntu.com/community/RootSudo suggests:

If you really need a persistent Root login, the best alternative is to simulate a Root login shell using the following command...

sudo -i

Solution 4:

First of all you need to have admin privileges. If you don't have admin privileges then while booting press and hold the shift key. You will enter the GRUB menu. Here select recovery mode. When you see the list of options like dpkg etc, choose to start a root shell and type:

adduser username sudo

(where username is your username :-) )

this will add you to the sudoers group! Then type exit and boot normally. when you enter your account, type:

sudo passwd root

Then enter your password and type the new root password

After that you can type su and enter the 'root' password.

If you don't want to change the root password then you can use:

sudo -i

to start a root shell, using your own password.