Categories: Ubuntu

How to Change the Password on Ubuntu 22.04

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).

Guide

Following are the two ways you can change a password on Ubuntu 22.04:

Method 1: Change Password via Command Line

Change the Current User’s Password via Command Line

Sponsored

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:

passwd

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:

su –

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.

passwd

Example:


Given the second scenario, you hold sudo privileges. To change the password, run the previous command but with sudo this time.

sudo passwd

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.

Change Root User’s Password via Command Line

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.

Sponsored

Suppose you have root level access, then switch to the root account by issuing the following command:

su –

Now, you can change the password for root using the passwd command as demonstrated below:

passwd

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:

sudo passwd root

Again, you will be asked to provide the new password twice.

Method 2: Change User Password via GUI

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.

Conclusion

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.

Ubuntu Server Admin

Recent Posts

Kolla Ansible OpenStack Installation (Ubuntu 24.04)

Kolla Ansible provides production-ready containers (here, Docker) and deployment tools for operating OpenStack clouds. This…

1 day ago

Canonical announces first Ubuntu Desktop image for Qualcomm Dragonwing™ Platform with Ubuntu 24.04

This public beta enables the full Ubuntu Desktop experience on the Qualcomm Dragonwing™ QCS6490 and…

2 days ago

The long march towards delivering CRA compliance

Time is running out to be in full compliance with the EU Cyber Resilience Act,…

2 days ago

Extra Factor Authentication: how to create zero trust IAM with third-party IdPs

Identity management is vitally important in cybersecurity. Every time someone tries to access your networks,…

3 days ago

Ubuntu Weekly Newsletter Issue 889

Welcome to the Ubuntu Weekly Newsletter, Issue 889 for the week of April 20 –…

5 days ago

From pidfd to Shimanami Kaido: My RubyKaigi 2025 Experience

Introduction I just returned from RubyKaigi 2025, which ran from April 16th to 18th at…

5 days ago