Today, we will explore the two methods to change the password in a Linux system. One method follows the change of password via Graphical User Interface (GUI) and the other method involves using the Linux commands that are executed on Linux command line OR Terminal to change the password.
Method 1: Change the Password via GUI
Let’s begin by first exploring how to change a user’s password in Linux via GUI. On the top right of the screen, locate the icons of the battery and other settings. Click on it. A window will open as shown in the following:
Next, click on the Settings and go to the Users option that is available on the left panel.
As you can see, the password option is available at the center of the screen. Click this option to change the user’s password. Now, enter the current password and then a new password. Choose a password that is strong to keep your system secure against brute force attack.
This is how we change a password via GUI. So simple!
Method 2: Change the Password via Linux Command Line
Some users are more comfortable with the command line rather than the GUI. This section is for those people!
Let’s see how a password is changed via Linux command line or Terminal.
Change Your Own Password
First, we will see how a user can change his own password. For that, the passwd command is used followed by the username as shown in the following:
Example:
Here, the user is azifa and we are changing azifa’s password.
First, the user is prompted to provide the current password. Once it is accepted, the user gives the new password.
Change the Password for Another User
What if another user’s password must be changed, how is that going to happen? Well, it’s also as simple as changing your own password. The only difference is that the system administrator can only change another user’s password.
In this case, we use the previous command but with sudo:
Sudo allows an access as a super user after accepting the password for sudo. After that, you will be prompted to change the password for the mentioned user.
Example:
Change the Sudo Password
To change the sudo password, you need as a super user. To do that, execute this command and then provide a sudo password:
Once you get the root access after providing the sudo password, execute the passwd command followed by the username to change the password:
Example:
You can also directly use the passwd command with sudo. First, you will be prompted to enter the sudo password. Once accepted, you can change the root password as we did before.
This is how we use the Linux command line to change the password.
Conclusion
Today, we explored the different ways where we can change the password in a Linux system. Some users are more comfortable with the Linux command line. However, some like to interact with GUI more than the Linux terminal. We provided a detailed guide to change the password for both types of Linux users. The guide is supported by different examples that will help you learn.
We hope you liked the tutorial.