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

Sponsored

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:

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

Canonical at India Mobile Congress 2024 – a retrospective

With an ambition to become Asia’s technology hub for telecommunications in the 5G/6G era, India…

6 hours ago

Imagining the future of Cybersecurity

October 2024 marks the 20th anniversary of Ubuntu. The cybersecurity landscape has significantly shifted since…

6 hours ago

Join Canonical in Brazil at Dell Technologies Forum São Paulo

Canonical is excited to be a part of the Dell Technologies Forum in São Paulo…

5 days ago

6 facts for CentOS users who are holding on

In 2020, it was announced that CentOS 7 would reach end of life (EoL) by…

5 days ago

What is Ubuntu used for?

The launch of Ubuntu in 2004 was a step-change for everyday users and developers everywhere.…

6 days ago