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

Microsoft Edge Installation on Ubuntu 24.04

Microsoft Edge is now available for Ubuntu. In this guide, I’ll walk you through the…

11 hours ago

How we used Flask and 12-factor charms to simplify Canonical.com development

Our latest Canonical website rebrand did not just bring the new Vanilla-based frontend, it also…

18 hours ago

Web Engineering: Hack Week 2024

At Canonical, the work of our teams is strongly embedded in the open source principles…

2 days ago

Ubuntu Weekly Newsletter Issue 873

Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…

3 days ago

How to resolve WiFi Issues on Ubuntu 24.04

Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…

3 days ago

Remembering and thanking Steve Langasek

The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…

4 days ago