Skip to content

How to change password in Linux?

  • by
  • 3 min read

Many users run Linux as their OS of choice because of its numerous advantages as a secure operating system. Any OS, no matter how secure, however, needs a good password.

Linux distros let users create a password for their user accounts when they install the OS. However, changing the password later isn’t exactly difficult either.

In this article, we’re taking a look at how you can change user password in Linux.

Also read: How to rename a file in Linux?

How to change your own user account’s password?

A regular user on your Linux installation can change their password using the passwd utility. All you have to do is type passwd in the terminal and hit enter.

How to change password in Linux? | Candid.Technology

You will then be prompted for your current Unix password, followed by the new password you want to have. Once you’re done, the password on your Linux account would’ve been updated.

Also read: How to use SCP command to transfer files in Linux?

How to change any other user’s account password?

The root user or a user with sudo privileges can change other user’s passwords as well. This is done using the passwd utility as well, except this time, we’re going to pass the account’s username as an argument to the command.

sudo passwd accountname
How to change password in Linux? | Candid.Technology

You will be prompted to enter a new password and then confirm the same. Once you’re done, the mentioned username’s account password will be changed. 

Also read: How to unzip Tar Gz file?

How to promp a user to update their password on the next login?

Another more elegant way of changing another account’s password is to force them to update their password the next time that particular user logs in to the system.

This is done using the following command.

sudo passwd --expire accountname
How to change password in Linux? | Candid.Technology

When the aforementioned command is executed, the password for the specified user will immediately expire. The next time they log in, they’ll be prompted to enter a new password.

Also read: How to check the list of users in Linux?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: