System Status
Buy Now
  • Email & Apps
  • Office 365
Login
  • MyRackspace Portal
  • Cloud Control Panel
  • Rackspace Webmail Login
  • Cloud Office Control Panel
  • Support Home
  • How-To
  • Developer Documentation
  •  Blogs 
    • Expert Insights Tech Blog
    • Rackspace Blog
    • Solve: Thought Leadership

Support Network

End-to-End Multicloud Solutions.   Solving Together.™   Learn more at Rackspace.com

How–To Home

Cloud Servers

  • Introduction
  • FAQ
  • All Articles

Set or change a user password in Linux

Last updated on:  2020-05-28

Authored by:  John Abercrombie


Whether you want to assign a password to a new user or proactively protect your environment by regularly changing your password, you use the same command—regardless of which distribution of Linux® you use.

When you change or set a password, you need to know one detail—are you changing your password or another user’s? Depending on your answer, the passwd command might use an extra parameter.

Set or change your password

Perhaps your department has a policy that requires you to change your password periodically. You just logged in to your server and received a notification that you have had the same password for over 90 days. For this example, your username is TestUser.

To change your password, while logged in to your server as your user, run the following command:

passwd

When entered without other parameters, the passwd command defaults to the current user (the one you are currently logged in as). The server gives you the following prompts:

Changing password for TestUser
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

In this example, because you already have a password, the command prompts you for your current password first to ensure you are the person making this change. No one can change your password while you’re logged in without your knowledge.

Set or change another user’s password

If you need to change someone else’s password, you must run the command as the root user. Because the root user is the system administrative user, it can change any user’s password at any time. To change the password for User2, add the username after the command as shown in the following example:

passwd User2

or

sudo passwd User2

Adding the username after the passwd command tells the command that you are changing a different user’s password and not your own. The following prompts display:

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

After you’ve entered, and reentered, the new password successfully, the password for that user is now changed. If you changed someone else’s password, you need to share the new password with the user.

Share this information:

©2020 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

See license specifics and DISCLAIMER

About Rackspace
  • About
  • Customer Stories
  • Events
  • Programs
Blogs
  • The Rackspace Blog
  • Expert Insights Tech Blog
  • Solve: Thought Leadership
  • News
  • Contact Information
  • Legal
  • Careers
Site Information
  • Style Guide for Technical Content
  • Trademarks
  • Privacy Statement
  • Website Terms
Support Network
  • Support Network Home
  • Rackspace How-To
  • API Documentation
  • Developer Center
  • ©2020 Rackspace US, Inc.