Enabling the root user password on Ubuntu
Enabling the root user password is convenient when you first setup a server. Often there are many procedures that require root access. If you have the root account enabled you will save yourself the time and keystrokes that it takes to emulate the root user with the “sudo” command. You also have the option of disabling the root user when you are done.
(*note: Commands preceded by a “$” are run as a normal user and commands preceded by a “#” are run as root.)
Enabling the root user takes only a few simple steps. We start by logging into the server with our basic user account.
Once, logged in we need to enable and set a password for the root account. This is done with the “passwd” command. In order to use the passwd command we will emulate the access rights of the root user with the “sudo” command.
Enter the command:
$ sudo passwd root
Before giving you access to the passwd command, sudo requires a password for authentication. This is the privileged password you created during the install.
After authenticating, the passwd command asks what you want to set as the root password.
You will need to enter the new password again to confirm the new password.
If everything went smoothly, you should receive a successful password change message.
Let’s check to see if we have successfully enabled the root account. This is done by using the “su” command. The su command stands for Substitute User. It allows a person to change their session to receive the security permissions of another user. It is usually used to change to root user permissions.
Enter the command:
$ su
Before access to root is permitted you will need to enter the root user password.
You can tell when you are logged on a root when the command prompt begins with the username root and ends with the # symbol.
When you are done using root privileges, don’t forget to exit out of the root session!
Tags: linux, passwd, root, sudo, ubuntu











