How To

Change User Password in Ubuntu: Command Line and GNOME GUI

Using a strong, unique password for every account is one of the most effective security habits. A compromised password accounts for a large share of account breaches, and reusing passwords across services means one breach cascades into many.

This guide shows how to change a user password in Ubuntu from the command line with the passwd command, and through the GNOME Settings app.

Change Password in Ubuntu from the Command Line

The passwd command handles password changes in Ubuntu and all other Linux distributions. Despite its name, it does not write to /etc/passwd. Passwords were originally stored there, but since /etc/passwd is world-readable by all users, they were moved to /etc/shadow – a file readable only by root. passwd updates the hashed password entry in /etc/shadow.

To change your own password, run passwd with no arguments:

bashpasswd

You are prompted in three steps:

  1. Current password – confirms you are the account owner, not someone who walked up to an unlocked terminal
  2. New password
  3. Retype new password – prevents a typo from locking you out of your own account
Changing password for linuxize.(current) UNIX password:Enter new UNIX password:Retype new UNIX password:passwd: password updated successfully

Passwords are not shown on screen as you type — standard terminal behavior to prevent shoulder surfing. Use the new password the next time you log in.

Change Another User’s Password as Root or sudo

Changing another account’s password requires sudo privileges:

bashsudo passwd sansa

When run with sudo, the command does not prompt for the user’s current password. Root bypasses the current-password check, which is exactly why this method works for resetting a forgotten or locked account, there is no chicken-and-egg problem.

You are prompted only to enter and confirm the new password:

Enter new UNIX password:Retype new UNIX password:passwd: password updated successfully

Force a password change at the next login. When you set a password for someone else, it is good practice to expire it immediately so the user sets their own rather than keeping the admin-assigned one:

bashsudo passwd -e sansa

This marks the password as expired. The next time that user logs in, they are required to set a new password before the session starts.

To review an account’s password expiry details:

bashsudo chage -l sansa

The output shows the last password change date, the expiry date, and the warning period — useful when auditing password hygiene across multiple accounts on a shared server.

Change Password in Ubuntu Using the GNOME Settings App

Open Settings from the Activities overview or the top-right system menu.

In the sidebar, select System, then click Users.

To change your own password: click the Password row directly. The change-password dialog opens without extra authentication.

To change another user’s password: click Unlock at the top of the panel first. This triggers a PolicyKit authentication prompt — you authenticate with your sudo password to gain elevated access to user account management. Once unlocked, select the target account and click the Password row.

In the dialog, enter the current password for the account, then type and confirm the new password. Click Change to apply.

These steps match Ubuntu 26.04 with GNOME. Earlier Ubuntu releases follow a similar path but the panel layout may look slightly different.

Keep passwords at least 16 characters long and mix letters, numbers, and symbols. Change any password immediately if you suspect it has been exposed or shared. Leave a comment below if you run into any issues.

Cyber Defence

Recent Posts

What Is a Data Protection Platform and Why Your Organization Needs One

A data protection platform is a unified system that helps organizations discover, classify, monitor, and…

2 weeks ago

How Swiss Privacy Rules Affect AI Companies Under GDPR

AI companies operating in or around Switzerland face a compliance challenge that most legal teams…

2 weeks ago

Swiss FADP vs EU GDPR: Key Differences for AI and Data Privacy

Two major data privacy laws now govern how organizations handle personal data across Europe; the…

2 weeks ago

Kali Linux Commands Cheat Sheet: Complete Quick Reference

This cheat sheet covers the essential Kali Linux commands every pentester and ethical hacker uses…

2 months ago

What I Wish I Knew Before Learning Malware Analysis and Reverse Engineering

When I first started learning malware analysis and reverse engineering, I thought the hardest part…

2 months ago

git fetch vs git pull: How They Work and When to Use Each

Both git fetch and git pull talk to a remote repository, but they do very different things to your…

2 months ago