A password is a word, phrase, or string of characters used to verify the identity of a user during the authentication process. It is used to differentiate an authorized user from an unauthorized user.
Today we will explore how to change a password on Ubuntu 22.04 using two different ways. The first method involves changing the password using the command line (Terminal). In the second method, we will see how a password is changed using Graphical User Interface (GUI).
Following are the two ways you can change a password on Ubuntu 22.04:
Change the Current User’s Password via Command Line
Let’s begin by changing your own password. To do that, all you need is a passwd command, followed by your username as shown below:
Example:
Once the command is executed, you will be asked to enter your current user password. Once it is accepted, you can now type the new password you wish to set and hit enter to save it.
Change Another User’s Password
In the previous demo, we saw how to change a current user’s password. To change another user’s password use the two simple methods: switch to the root account or use the standard account but with sudo.
Considering the first scenario that you have root access, then switch to it using the following command:
You will be asked for the root password to be able to use root account.
Once you have got the access, you can now change the password. Use the passwd command followed by the username to accomplish that.
Example:
Given the second scenario, you hold sudo privileges. To change the password, run the previous command but with sudo this time.
Example:
You will be asked to enter your current user password. Once accepted, you can type the password you are changing for a particular account.
Now, it is time to see how we can change the password for a Root user. Again, you either need to switch to the root account or use the standard account with sudo.
Suppose you have root level access, then switch to the root account by issuing the following command:
Now, you can change the password for root using the passwd command as demonstrated below:
Example:
You will be asked to enter the new password twice. Once the password is changed, you will see a confirmation message like this on your terminal:
To change the password directly using sudo, you will have to execute the passwd command with sudo followed by root username as shown below:
Again, you will be asked to provide the new password twice.
Now that we have explored how to change a password using the command line, let’s now explore how it could be done using Ubuntu’s Graphical User Interface (GUI).
To do that, go to the Settings.
Then find the Users tab in the left panel.
To change the password first, enter the current password to authenticate yourself. Then provide the new password you want to keep. Make sure it matches a good security strength.
In today’s guide, we saw in detail how to change a paAssword in Ubuntu. We first explored how to change a password via Ubuntu’s command line and then we saw how the same thing can be achieved via Ubuntu’s GUI.
Kolla Ansible provides production-ready containers (here, Docker) and deployment tools for operating OpenStack clouds. This…
This public beta enables the full Ubuntu Desktop experience on the Qualcomm Dragonwing™ QCS6490 and…
Time is running out to be in full compliance with the EU Cyber Resilience Act,…
Identity management is vitally important in cybersecurity. Every time someone tries to access your networks,…
Welcome to the Ubuntu Weekly Newsletter, Issue 889 for the week of April 20 –…
Introduction I just returned from RubyKaigi 2025, which ran from April 16th to 18th at…