How to Change User Password in Ubuntu: A Step-by-Step Guide

change user password ubuntu

Changing a user password in Ubuntu is a simple process that can be done through the command line interface. In this article, we will guide you through the steps to change the password for a user account in Ubuntu.

Prerequisites

Before we start, you need to have access to an Ubuntu machine with administrative privileges. You should also know the username of the account for which you want to change the password.

Step 1: Open the Terminal

To open the terminal, press Ctrl+Alt+T on your keyboard. Alternatively, you can search for the terminal in the applications menu.

Step 2: Identify the User Account

To change the password for a user account, you need to know the username of the account. You can list all the user accounts on your system by running the following command:

cut -d: -f1 /etc/passwd

This command will display a list of all the user accounts on your system.

Step 3: Change the Password

Once you have identified the user account, you can change the password using the passwd command. Run the following command:

sudo passwd username

Replace username with the actual username of the account for which you want to change the password. You will be prompted to enter the new password twice.

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

That’s it! The password for the user account has been changed.

Additional Tips

  • If you want to force the user to change their password the next time they log in, use the passwd -e command. This will expire the user’s password and require them to set a new one upon their next login.
  • If you want to disable a user account, use the passwd -l command. This will lock the user’s account and prevent them from logging in.
  • If you want to unlock a user account, use the passwd -u command. This will unlock the user’s account and allow them to log in.

Conclusion

Changing a user password in Ubuntu is a simple process that can be done through the command line interface. By following the steps outlined in this article, you should be able to change the password for a user account in Ubuntu with ease. Remember to keep your passwords secure and change them regularly to ensure the safety of your system.