Being an administrator, it is a good habit to change the password of your computer system randomly. These changes can be performed due to many reasons such as to secure the system or forgetting the password etc. A root user has the access to all the system’s settings whereas the non-root user has minimum authorization.
This post will demonstrate various methods to change the password on Ubuntu 22.04. This post serves the following learning outcomes:
- Change the password on Ubuntu 22.04 using CLI
- Change the password on Ubuntu 22.04 using GUI
- Change the root password on Ubuntu 22.04 (if forgotten)
Let’s start with the first one:
Method 1: Change the password on Ubuntu 22.04 using CLI
The Command Line Interface utility provides an easy to access and use the terminal for several purposes. The following command syntax leads you to change the password of the user:
$ passwd <username>
Here, the “passwd” command refers to the password, while the “Username” indicates an account name.
In our scenario, we are going to update the password of username “itslinux” on Ubuntu 22.04.
$ passwd itslinux
From the output:
- First, enter the current password.
- Then, set and verify the new password.
Finally, you will get a success message “password updated successfully”.
Method 2: Change the Password on Ubuntu 22.04 Using GUI
The GUI of Ubuntu 22.04 can be used to change the password by following the below-mentioned steps:
Step 1: Open Settings
Click on “Activities” and move towards the “search bar” to find the settings as follows:
After clicking on the launcher, the settings will open:
Step 2: Open the Users Tab
In the left pane of “Setting’s” window, navigate to the “Users” tab and open it:
All the users of the system are available, and their settings can be changed here.
Step 3: Select the User Account
Select the “user account” to whom you want to change the password (in our case, the username is “itslinux”):
Step 4: Change the password
To change the password of a user account, navigate to the “Authentication & login” section and click on the “Password”:
In the following pop-up:
- Enter your current system password.
- Set a new password.
- Confirm a new password.
Finally, click the “Change” button:
Password has been changed successfully on Ubuntu 22.04.
Method 3: Change the root password on Ubuntu 22.04 (If forgotten)
If you forget the root password on Ubuntu 22.04, you can change it using the Grub Menu. for this purpose, use the below-mentioned procedure one by one:
Step1: Open the GRUB Menu
Restart the system and once the system starts up. During this process, hold the “Shift” key. It will open the following interface:
Step 2: Edit the GRUB Menu
To change the boot entry in the Grub Menu, press the “E”. It will permit to edit the GRUB menu:
Insert the following command in the GRUB Menu at the end of the linux line:
rw init=/bin/bash
Step 3: Boot the System
After the configuration, boot the system using the “F10” button or “Ctrl+X” key:
Step 4: Check the Root Access
To check the root access in the system, run the following command:
mount | grep -w /
Step 5: Change the Root Password
To change the root password of a system, run the following command:
Passwd
and then;
- Set a new password
- Retype/verify the new password
The output showed that “password updated successfully”.
Step 6: Reboot the System Again
After changing the root password, reboot the system by running the following command and hitting the “Enter” button:
exec /sbin/init
The system will reboot to save all the changes.
Congratulations! You have learned successfully to change the password on Ubuntu 22.04 using several methods.
Conclusion
The password can be changed on Ubuntu 22.04 using the “passwd <username>” command or from the “Users Settings”.The continuous updating of passwords helps in securing your system from unauthorized access. This post has provided various methods to change a user’s password on Ubuntu 22.04. Additionally, you have also learned how a root password can be changed if it is forgotten.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY