shumail shabeeh shaheeh
January 29, 2024

How to change the user password in Linux – Change Password Linux

Embrace Love: Share Us on Social Media

Securing user accounts is a critical aspect of maintaining a secure Linux system. One fundamental practice in ensuring user account security is regularly updating passwords. Changing passwords helps mitigate potential security risks and ensures that unauthorized access is minimized. This article provides a detailed guide on how to change password Linux.

Managing User Passwords in Linux: A Comprehensive Guide

Change Your User Password

To change your own user account password in a Linux environment, the passwd command is the go-to tool. Open a terminal and execute the following command:


Change Password Linux

After entering this command, you will be prompted to input your current password. Once confirmed, you’ll be asked to enter and confirm the new password. It’s important to note that, for security reasons, passwords are not displayed on the screen as you type them.

Upon successful completion, the new password is set, and you can use it during your next login to the system.

How to Add a User Name?

In Linux, the process of setting a username involves creating a new user account if you don’t have one.

Use the useradd Command

To create a new user account, you can use the useradd command followed by the desired username. For example, to create a user named “newuser,” type the following command:

sudo useradd newuser

Change Another User’s Password

Changing another user’s password requires administrative privileges, typically held by the root user or users with sudo access. Assuming you have the necessary privileges, use the passwd command followed by the newuser to change another user’s password:

sudo passwd newuser

Change Password Linux

Replace newuser with the actual username of the user for whom you intend to change the password. After executing the command, you’ll be prompted to enter and confirm the new password.

Upon successful password change, the command will display a message indicating that the password has been updated.

Force User to Change Password at Next Login

By default, Linux passwords are set to never expire. However, administrators can enforce a password change for a user at their next login. To do this, use the passwd command with the --expire option followed by the newuser username:

sudo passwd --expire newuser


Executing this command immediately expires the user’s password. When the user attempts to log in with the old password, they will receive a warning message instructing them to change their password. After setting a new password, the connection will be closed.

Password Policies and Complexity

Linux systems often implement password policies, which include requirements such as minimum length, the inclusion of special characters, etc. When changing or setting passwords, ensure compliance with these policies to maintain a robust security posture.

Password Aging Policies

Linux supports password aging, allowing administrators to set expiration dates for passwords. The chage command can be utilized to configure password aging policies. For example:

sudo chage -d 0 newuser

This command sets the last password change date to the current day, prompting the user to change their password upon the next login.


Can I change another user’s password on a Linux system?

Yes, but you need administrative privileges. Use the sudo passwd username command, replacing “username” with the target user’s actual username. You’ll be prompted to enter and confirm the new password.

What should I do if I forget my user password in Linux?

If you forget your password, you may need to reset it using recovery methods, such as booting into single-user mode or using a live CD/USB. Consult your distribution’s documentation for specific instructions.

Are there any password complexity requirements in Linux?

Yes, many Linux systems implement password policies with requirements like minimum length, special characters, etc. Ensure that the new password complies with these policies to avoid any issues.

How can I verify if a user’s password change was successful?

Upon successfully changing a password, the system will usually display a message, such as “passwd: password updated successfully.” Additionally, you can try logging in with the new password to confirm its effectiveness.

Is there a graphical tool for changing user passwords in Linux?

Yes, some Linux desktop environments provide graphical tools for changing user passwords. For example, on GNOME-based systems, you can use the “Settings” application to change your password.


In this comprehensive guide, you’ve acquired the knowledge to change user passwords in a Linux environment, both for your account and for other users with administrative privileges. Additionally, we explored the option to force a user to change their password at the next login, adhering to password policies and implementing password aging policies for enhanced security. Regularly updating and managing passwords is a fundamental practice in maintaining a secure Linux system.

Follow CyberHosting on Facebook Twitter Linkedin for updates.

If you want to get rid of the hosting and server issues checkout our plans in the USA. Other plans are also available in our pricing page.

Stay in the loop!

If you found this article helpful, join our mailing list to receive CyberHosting updates and latest news from the LiteSpeed community.

  • Only useful information.
  • Relevent to hosting and LiteSpeed.
  • No spam. Ever.

By joining our mailing list you agree to receive periodic communications from CyberHosting. You can unsubscribe from within our emails any time.