Enable Root Account Login On Ubuntu

In this guide I will quickly show you how to enable root logins for Ubuntu. As you may have noticed while installing Ubuntu, you are not prompted to set a root password. This is why you cannot login as root. There are a couple of solutions to overcome this, here are a couple below.

Enable Root Account On Ubuntu

You can allow your root account on Ubuntu to be logged in like any other account by setting a password for it. This can be done with the passwd command. Note that while you can enable it, that doesn’t mean you should enable it. You are much better off just using the second method below.┬áHere is the command to enable your root account.

sudo passwd root

Open A Root Session Using Sudo

The other main option that you have is using sudo to login as root, you do not need to use the first method to do this. This will create a root session inside of your current session. You can accomplish this by running either of the following commands. Note that the – at the end is for changing your directory to /root/ (the root account’s home directory). You can leave out the – if you would like to stay in your current working directory.

sudo su -
sudo su

In order for the above to work, you must have sudo privileges. If you do not have sudo privileges then you will be unable to switch into the root account with this method.

Thanks for reading, please don’t forget to like, share, or comment below. Thanks!


Leave a Reply

Your email address will not be published. Required fields are marked *