CentOS

How to Change Password on CentOS 8

Data is precious. Some people are even calling it the new Gold. It is essential to change your password from time to time to ensure that your data remains protected from malicious activities. Most people only have a single password for everything, and they use it for years which is an unsafe practice and can expose them to dangerous cybercrimes like identity theft. When setting a password, one should always ensure to set a unique and strong password.This article will present an extensive guide on changing your password on CentOS 8 operating system by using two different methods.

  • Through GUI
  • Through Terminal

Moreover, we will also learn how to change other users’ passwords on CentOS 8 Operating system. Let’s begin with the first method to change the password using the GUI of CentOS 8.

Method 1: Changing the User Password through GUI

This method of changing the user password is the most convenient and user-friendly.

Step 1: First, open the dropdown menu from the top right corner:

Step 2: Now click on your username and select account settings for changing the settings of the current logged in user:

Step 3: First, you need to click on the unlock button as shown in the screenshot attached below so you can edit and change the user’s settings:

Step 4: A prompt will occur to ask the password of the currently logged-in user, so type in your password and click on the “Authenticate” button to unlock the settings:

Step 5: Now, after unlocking the settings, you can change any settings of the user. To change the password specifically, you have to click on your encrypted password:

Step 6: It will open a new window, where you can enter your current password to confirm and the new password that you want to set:

After entering your passwords, click on the change button on the window’s top right corner, as highlighted in the above screenshot.

Congratulations! Your password has been changed successfully using the GUI of CentOS. From here on out, you will have to use the new password to login into your account.

Now let’s learn the following method and modify the password of an account using the terminal.

Method 2: Changing the User Password through Terminal

When you are using a CentOS 8 server only without a GUI, and you only have access to the terminal of the CentOS 8 Operating system, then the GUI method won’t work. We have to change the password using the terminal, and we can do so easily.

This method for changing the user password is as easy as it is fast. It can work on almost any Linux distribution like CentOS 8 or Ubuntu 20.04. Simply follow the steps provided below to change your password through the terminal:

Step 1: First of all, open up the terminal of the CentOS 8 Operating system from the application menu.

Step 2: In the terminal, type the “passwd” command and press Enter to change the password:

$ passwd

You will be asked to input your current password:

If you have entered the correct, current password, it will ask you to input your new password:

Once you entered the new password that you want to set, it will ask you to confirm your new password:

The password will get changed if both passwords match, and a success message will appear on the terminal.

Instead of changing the password of the currently logged-in user, if you want to change another user’s password, then we can do so as well. Let’s learn how to change other user’s passwords on CentOS 8 Operating system.

How to change another user’s Password in CentOS

It may come to you as a surprise, but it is possible to change other users’ passwords, but it can only be done by root users or users with Sudo privileges. Regular user can only change their own password.

For changing the password of any other user on the CentOS 8 Operating system, the first step is to fire up the terminal and log in as a root user using the command typed below:

$ su

Enter the root user’s password, and you will be logged in.

Once you’re logged in as a root user or have sudo privileges, input the “passwd” command followed by the user name to change that user’s password. If you are logged in as a root user, you do not have to execute the “passwd” command with the sudo keyword.

In the following example, we take a user named “test_user” as an example. To change this user’s password, run the command given below:

# passwd test_user

The terminal will directly ask you to input the new password and confirm the new password:

You will get a success message:

If the passwords match, the password of the “test_user” will be changed. The “test_user” will have to log in with the newly set password by the root user.

Conclusion

In this post, we have discussed changing a user’s password on CentOS 8 Operating system. We learned two different methods of changing one’s own password. Additionally, we also learned to change other users’ passwords if we are logged in as root users or have sudo privileges.

As mentioned above, Data protection is a modern-day necessity. Data is now being labeled as a valuable commodity. Nowadays, it has become an absolute must to use unique, complicated, and strong passwords to protect your data.

We learned how to change the password manually using the GUI of the CentOS 8 Operating system. This process is straightforward and user-friendly. We also learned how to change the password using commands on Linux Terminal. This process is rapid and efficient.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.