How To Change Root Password In Ubuntu

In this piece, I will walk you through the steps to modify the root password on Ubuntu. As a Linux user, it is crucial to have authority over your system by creating a robust and well-protected root password. By adhering to the instructions below, you can successfully alter the root password and fortify the safety of your Ubuntu system.

Step 1: Accessing the Terminal

To begin, you need to open the Terminal in Ubuntu. You can do this by pressing Ctrl+Alt+T on your keyboard. Once the Terminal opens, you are ready to proceed with changing the root password.

Step 2: Logging in as Root

To change the root password, you need to have root privileges. By default, most Ubuntu systems do not enable the root account, so we will need to use the sudo command to execute commands as root.

Let’s start by logging in as root. In the Terminal, type the following command:

sudo -i

You will be prompted to enter your user password. After providing the password, you will be logged in as root.

Step 3: Changing the Root Password

Now that you are logged in as root, you can proceed with changing the root password. In the Terminal, type the following command:

passwd

You will be prompted to enter a new password for the root account. Make sure to choose a strong password that includes a combination of uppercase and lowercase letters, numbers, and special characters. It is important to create a password that is hard to guess.

After entering the new password, you will be asked to re-enter it to confirm. Once you have successfully confirmed the new password, the root password will be changed.

Step 4: Exiting Root and Testing the New Password

Now that the root password has been changed, you can exit the root session in the Terminal. Simply type the following command:

exit

You will be returned to your regular user account. To test the new root password, you can try logging in as root again using the sudo -i command. If the new password is working correctly, you will be logged in as root without any issues.

Conclusion

Changing the root password in Ubuntu is a simple process that can be done with just a few commands in the Terminal. By following the steps outlined in this article, you can enhance the security of your Ubuntu system and have control over your root account. Remember to choose a strong password that is hard to guess and keep it secure.