How To Change Root Password in Ubuntu

Sometimes you may need to reset root password or change root password in Linux, for administrative purposes. Here is how to change root password in Ubuntu. You can also use these steps to reset root password in Redhat Linux, CentOS, and other Linux systems.


How to Change Root Password in Ubuntu

Here are the steps to change root password in Ubuntu.

Open terminal and run the following command to change root password.

# sudo passwd root

We use the passwd command to set the password for all users in Ubuntu, including root. In order to change user password, you need root privileges. So you need to use sudo command.

Also read : How to Enable IPv6 in Apache

You will see a prompt where you need to enter new password and confirm it.

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

That’s it. Now your new root password will be set.

Also read : How to Upgrade Django Version

Here are a few things to keep in mind before changing root password in Linux.

  1. By default, the root user does not have a password. So you cannot log into Linux as root user. In other words, root user is disabled in Linux. This is for security purposes.
  2. When you change/set/reset root password, then it becomes possible to log into Ubuntu as root user. So be careful before you do this.
  3. Make sure you use a strong password for root, so that it is not easily guessable.
  4. Instead of logging in as root user, it is recommended to use sudo command to run commands that require root privileges. It allows you to change root password without login.

Leave a Reply

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