How To Set The root Password In Ubuntu

By default ubuntu has an unknown password set. It is very rare that you would ever need to login as root but if you do you will need to have a password set. To set the password for root it is as simple as typing in a command in a terminal / command line.


When you set the root password you will need to be logged in with a user that has sudo access. Often times the user that you created when you setup your Ubuntu system will have sudo access.


If you are setting this on a desktop computer you will need to open a terminal to issue the following command. Since the default server does not have a graphical interface you will just need to enter the command.

Tips on how to open a terminal:


Gnome 2:


Let's get started. Enter the following command in a terminal or bash window.

sudo passwd root




Create a password for the root user with the following command: sudo passwd root



Enter your password (sudo user password)



Enter the password of the user with sudo access



Create a password



Create a password for the root user



Confirm password



Enter the password one more time to confirm it



To login and test out the new root users password, use the  su command to switch users.




Enter su to switch to the super user



You can now issue commands as the root user. Just be really careful because if you make a mistake the root user will have the access to do it.

Hope you found this useful!