How to Change User Password in Linux

Passwords safeguard Linux users’ accounts. All Linux users’ settings and files are accessible by logging in and require the protection provided by the user’s password. Note that it is good practice for Linux users to change their passwords regularly. In this article, we’ll explain how to change your account password and other users’ passwords via both the GUI and the command line.

Note: For this guide, we’re using Ubuntu LTS 22.04, codenamed Jammy Jellyfish. Linux commands featured in this article are distro-independent, meaning they will work on any Linux distro.

Changing User Password via the GUI

Regardless of the desktop environment, all User GUI tools provide the same options to set the user password and make other modifications related to the user account.

Note that you must log in with an administrative account to perform the procedures included in this section. Also, note that, unlike the command-line passwd tool, you must be an administrative user to change your own password and other users’ passwords in the Linux GUI.

Changing Your Own Password via the GUI

  1. Launch Applications and select Settings.
  2. Select Users from the Settings menu, select your account, and click the Unlock button.

    Select Users from the Settings menu, select your account and click the Unlock button.
    Select your username from the list of users and click the Unlock button.
  3. Enter the administrative user’s password at the Authentication Required window and click Authenticate.

    Enter the administrative user's password at the Authentication Required window and click Authenticate.
    Enter the administrative user’s password and authenticate.
  4. Select the Password option from the Users window.

    Select the Password option from the Users window.
    Select the Password option from the Users window.
  5. When presented with the Change Password window, enter your current password in the Current Password prompt, enter your new password in the New Password: box, re-enter your new password in the Confirm New Password: box, and click the Change button.

    When presented the Change Password window, enter your current password in the Current Password prompt, enter your new password in the New Password: box, re-enter your new password in the Confirm New Password: box, and click the Change button.
    Enter your current password along with your new password. Retype. Click Change.
  6. You’ve successfully reset your Linux password.
  7. Close the Users window.

Changing Another User’s Passwords via the GUI

  1. Launch Applications and select the Settings icon.
  2. Select Users from the Settings menu, select the Linux user’s account whose password you want to change, and click the Unlock button.

    Select Users from the Settings menu, select the Linux user's account whose password you want to change, and click the Unlock button.
    Select the target username from the users list and click the Unlock button.
  3. Enter the administrative user’s password at the Authentication Required window and click Authenticate.

    Enter the administrative user's password at the Authentication Required window and click Authenticate.
    Enter the administrative user’s password and authenticate.
  4. Select the Password option from the Users window.

    Select the Password option from the Users window.
    Select the Password option from the Users window.
  5. Select the Allow user to change their password on next login radio button and click the Change button. Note that we could have used the Set a password now radio button, entered the new password, and confirmed the new password, but the Allow user to change their password on next login option is both the easiest and most secure.

    Select the Allow user to change their password on next login radio button and click the Change button. Note that we could have used the Set a password now radio button, entered the new password, and confirmed the new password, but the Allow user to change their password on next login option is both the easiest and most secure.
    Select the Allow user to change their password. Click Change.
  6. Close the Users window.
  7. You’ve successfully reset the other user’s Linux password.

Changing Passwords via the Command Line

passwd Command Purpose, Syntax, and Options

The passwd command is used to change a user’s password. The syntax for the passwd command is:

# passwd [options] [username]

There are no options used with the passwd command in either of the examples included.

Real-Life Scenario – Changing Your Own Password

  1. Launch the terminal.
  2. Enter passwd at the command prompt.
    # passwd
  3. Enter your new password at the New password: prompt.
  4. Retype your new password at the Retype new password: prompt.
  5. You will receive a password updated successfully message.

    Launch the terminal. Enter passwd at the command prompt. Enter your new password at the New password: prompt. Retype your new password at the Retype new password: prompt. You will receive a password updated successfully message.
    You will receive a password updated successfully message.
  6. Exit the terminal
  7. You’ve successfully reset your Linux password.

Real-Life Scenario – Changing Another User’s Password

Note that only the root user or users with superuser (root) privileges have the necessary permissions to change other users’ passwords via the passwd command.

  1. Launch the terminal.
  2. Enter passwd [username] at the command prompt. In this example, the username is techobservatory.
    # passwd techobservatory
  3. Enter the user’s (techobservatory’s) new password at the New password: prompt.
  4. Retype (techobservatory’s)  new password at the Retype new password: prompt.
  5. You will receive a password updated successfully message.
    Launch the terminal, enter passwd. Enter passwd [username] at the command prompt. In this example, the username is techobservatory. Enter the user's (techobservatory's) new password at the New password: prompt. Retype (techobservatory's)  new password at the Retype new password: prompt. You will receive a password updated successfully message.
    You will receive a password updated successfully message.
  6. You’ve successfully reset the other user’s (techobservatory’s) password.
  7. Exit the terminal.

Commands Used In This Article

  • passwd – change a user’s password.

Was this article helpful?

Leave a Comment