The password helps to fight against unauthorized access to the user’s system or important data as it is the first line of protection. Once the password is set, it can be reset or changed for security purposes or when the user forgets it. Like windows, the user can easily reset his Linux account password.
This post described the CLI and GUI methods to reset a password in Linux. The outline of this guide is as follows:
- Method 1: Reset the Password Using CLI
- Method 2: Reset the Password Using GUI
Let’s start with the command line method.
Method 1: Reset the Password Using the CLI
Linux and its distributions offer a wide range of command line utilities to access the system. From these utilities, we used the “passwd” command line tool in this method to reset the specified user’s password in Linux.
Reset the Logged-In User Password
First, open the terminal by utilizing the shortcut key “Ctrl+Alt+T”. Enter the “passwd” command in this way:
- The command will change the currently logged-in user (itslinuxfoss) password.
- Enter the current password that is encrypted and not shown in the terminal.
- If the current password is correct, type the “New password” for the “itslinuxfoss” user.
- Retype the new password again to confirm it.
The confirmation message “password updated successfully” has verified that the user “itslinuxfoss” password has been reset.
Reset the Password of a Particular User
The superuser or the root user can easily reset the other specified normal user via the “passwd” command. It will not prompt for the current user password.
In this scenario, the “passwd” command is used to change the password of “peter” as shown in the screenshot:
$ sudo passwd peter
Here, the confirmation message verifies that the “peter” user password has been updated.
Method 2: Reset the Password Using GUI
Apart from the command line, the Graphical User Interface also facilities Linux users to change or reset a password of their own or another particular user.
In our case, the currently logged-in user is “itslinuxfoss” (root-user), which will reset the “anna” user password. To perform this task, the following steps are considered:
Step 1: Open User’s Settings
Hit the “Show Application” icon in the dock panel. It opens up the application menu and a “Search” bar. Type the “users” in it and click on the shown result.
Step 2: Unlock the Settings
The “users” window will open having an “unlock” button at the top right corner. Click on it to unlock the “users” setting as shown below:
Step 3: Authenticate the Access
It requires the root user authentication “password” to apply any type of change to the particular user account settings. Enter the password to proceed with the process.
Note: If you don’t have the root user privileges then you can not reset any user’s password working in that Linux operating system.
Step 4: Choose the User
The “users” window shows all the users of the current working system “Ubuntu 22.04”. In this case, the “anna” user is selected. Click on the highlighted “password” option available in the “Authenticate & Login” section:
It generates a “Change Password” window. Select the second option “set a password” from this window and enter the “New Password” for “anna”. Again re-type it into the “Confirm New Password” field for verification. After that click on the “change” button:
Again enter the root user password for the authentication:
The “anna” user password has been reset.
Note: The GUI steps are performed on Ubuntu 22.04’s GUI, it would be the same for other Linux distributions as well that support GUI.
It’s all about how to reset a password in Linux.
Linux provides the “passwd” command line tool to reset a particular user password in Linux. This command line tool is beneficial to rest the currently logged-in user password or another user password. Furthermore, this task can also be performed using the “Change Password” window via GUI. This post has briefly illustrated both CLI and GUI methods to reset a password in Linux.