How to Change root user password ubuntu

Suppose you have just started using Ubuntu or switched to Ubuntu from another operating system and want to change the default root password but do not have enough knowledge about it. So this tutorial will help you know how to update your ubuntu operating system's current (or default) password. You can also adopt given methods to change the root password in many other Linux-based operating systems such as Kali Linux, Parrot, Debian, Fedora, etc.

Like several other Linux based operating systems Ubuntu also allows multiple user accounts, each having its password. In Ubuntu, every user only allowed to change or update the password of their own account.

How to Change root user password ubuntu

Introduction

On every Unix-like and Linux system, the superuser (or root user) is a unique user account. It contains unrestricted and complete access to every resource and command on the system. If we are switching from other distributions of Linux to Ubuntu, we might be surprised by what the root password (default) is and how to edit it. The superuser account is, by default, deactivated for security concerns in Ubuntu.

When we install Ubuntu, we are asked to establish a user account. It's a regular account with restricted privileges. We need to apply the sudo command to implement several administrative tasks. We are asked to input our user password, not the root password, when we apply the sudo command.

Switch root temporarily

Granting sudo powers to regular users inspires Ubuntu users to implement several duties of system administration. Authorized users can execute programs as other accounts, generally the root user, with the help of sudo.

The sudo class is already a representative of the account created by the Ubuntu installer. Likely, it is the user we are logged in to now, as it contains administrative access.

  • We can execute the below command to boost superuser privileges temporarily, prefixed using sudo:
    $ sudo command-name
  • We will be asked for the user password the very first time we utilize sudo in any session.
  • We can use the sudo -i or sudo su commands and enter the user password to switch to the superuser account temporarily in our correct login session:
    $ sudo su -
  • We can also use the following command to cross-check that the user has been modified:
    $ whoami

Related methods and concepts

In Ubuntu, the default password of Ubuntu is only one feature of system administration. There are various other methods and concepts that are associated with system administration, including:

  • Permissions: Ubuntu utilizes a permissions system for controlling access to directories and files. Knowing how permissions operate is necessary to manage the system.
  • User accounts: Ubuntu permits us to establish two or more user accounts along with different privilege levels. It can be useful to manage access to the system.
  • Package management: Ubuntu utilizes a package management system for installing and updating software. Knowing how the system operates is necessary to keep the system secure and up to date.
  • Services: Ubuntu executes various services inside the background, including file sharing, printing, and networking. Knowing how services operate is necessary to troubleshoot and manage the system.

Ubuntu Default Login Credentials

In Ubuntu, the root account is deactivated by default. The default user of Ubuntu for Ubuntu VPS is mentioned below:

Username: 'ubuntu'
Password: 'No default password'

When we first time install the Ubuntu server, we are supposed to set our password at the time of the starting setup process. If we have not yet set any password, we can log in as the 'ubuntu' user without any password, and we will be asked to set one during the first login.

For the 'ubuntu' user, it is highly suggested to set a secure and strong password as soon as possible to protect our Ubuntu Server installation. In Ubuntu, the username and password are defined as Ubuntu at the time of the installation process. We can not see any login password (default) of Ubuntu or other operating systems. In Ubuntu, the default root password of Ubuntu is locked by default.

Here we can find some advantages and drawbacks of using Ubuntu without root logins by default deactivated, including:

  • Often, people occasionally forget login passwords.
  • Sudo includes the command log access run. In case we were in trouble, we could visit the authorities and execute.
  • By default, it ignores the "I can do anything" It will ask for a password; modifications can happen.
  • All crackers attempting to brute-force their appearance in on any server will understand it contains an account called root.
  • They don't know what the usernames of our other users are because of the reason that the password of the root account is locked. This intrusion does not pose any risk at all because no password is available to guess or crack in the first location.
  • Permits easy admin right transfer by adding or deleting users. When we use just a single Ubuntu root password, we can modify the root password if we forget.
  • Sudo might be configured with a safety policy.

Prerequisites

  • Ubuntu installed and running
  • A user with sudo privileges
  • Access to a terminal/command line
  • The apt-get tool, pre-loaded in Ubuntu and other Debian-based distros

How to change the root password in Ubuntu?

Here we will discuss all three methods. You can use any of these methods to update the Ubuntu operating system's root password, which you find easy or comfortable.

The Ubuntu terminal is used in the first two methods, but don't worry, it is not that difficult. We will explain these methods in details as well as with the practical. Still, if you don't feel comfortable with the first two methods, you can use the easiest third method as it uses Linux's graphical interface or GUI.

Method 1- Changing the root password using the terminal

To change the root password using the terminal, consider the following given steps:

1. First of all, open the terminal by pressing the key "Ctrl + Alt + T" on the keyboard, as shown below:

How to Change root user password ubuntu

2. Once the terminal gets open, type the following given command and hit enter:

Command:

Once you hit enter after typing the command above, you will be prompted to enter and to verify the new passwords as shown in the given image:

How to Change root user password ubuntu

3. Now close the terminal using the following command:

Command:


How to Change root user password ubuntu

In some rear cases, to reflect or apply the changes, it may be quite possible that your operating system asks you to restart your system. If it happens, restart your system, and once you restarted your system, you are all set. Your root password is now changed or updated.

Method 2- Change sudo Password with the passwd Command

This method can be considered an alternate of the first method because, in this method, the user first switches to the root user(or superuser) and then runs the "passwd" command to change the root password. Consider the following instructions to change the password in Ubuntu:

1. First, open the terminal (CTRL+ALT+T).

2. Now, switch to the root user by the following command:

Once you execute the above command, you have to Enter/Type your current password and hit the Enter button. In the obtained output, you should notice that now you can run all the commands as the root user (or Super User).

How to Change root user password ubuntu

3. Next, to change the current password, use the following command:

Now, type the new password and press enter button. It will also ask you to re-enter your new password to ensure that both time you entered the same password. So type your new password one more time. If both passwords are identical, you can go to the next step. In the case where your password gets mismatched, you can re-write the "passwd" command and try again.

How to Change root user password ubuntu

4. After updating the previous password with new a password, you can log out of the root user by using the following command :

Output

How to Change root user password ubuntu

5. Now, you can Exit out of the terminal with the same command:

Option 3: Changing Ubuntu Password Using GUI

In order to change the default password of an individual account in Ubuntu, one can also do so using only the Graphic User Interface instead of using the terminal. To change the default root password in Ubuntu without using the terminal or any commands, consider the following the given steps:

1. First of all, open the Activities overview by pressing the Windows or by clicking on it shown below:

How to Change root user password ubuntu

2. Type the "Settings" in the search bar and click on the Settings icon. Once the setting icon appears, click on it to open, as shown below:

How to Change root user password ubuntu

3. In Settings, search for the "Details or Users". In our case, the desired settings are available under the "Users", as shown in the given image:

How to Change root user password ubuntu

4. Now click on the "Password" in order to change or update the current password as shown below:

How to Change root user password ubuntu

5. Once you click on the "Password", a prompt will open in which you will be asked to enter the current password, to enter the new password and then re-enter the new password. In most case, the obtained prompt looks like as given below:

How to Change root user password ubuntu

After filling up all required fields, all you have to do, click on the "Change" button as shown in the given image:

How to Change root user password ubuntu

6. Now, your password is updated. You can exit out form "Settings" by closing the current window, as shown below:

How to Change root user password ubuntu

Conclusion

In the above, we have discussed three methods to change the password for the root user in Ubuntu operating system. Each of all provided methods includes the simplest steps that anyone can follow and complete.

Note: A user should always ensure that his password includes both lower and upper letters, numbers, and special characters and should change or updated from time to time. It is essential that all users must use a strong password in order to avoid brute force attacks because a simple password can be cracked very easily and requires very little time to crack.






Latest Courses