≡ Menu

HowTo: Change Password of Specific User Account In Linux

Hdo I change passwords for specific user account under Linux operating system using the command line?

You need to use the passwd command to changes the user’s password.

Rules for changing passwords for user accounts

  1. A normal user may only change the password for his/her own account.
  2. The superuser (root user) may change the password for any account or specific account.
  3. The passwd command also changes the account or associated password validity period.

First, login as the root user. Use sudo -s or su - command to login as root. To change password of specific user account, use the following syntax:

passwd userNameHere

To change the password for user called vivek, enter:
# passwd vivek
Sample outputs:

Change Users Local Linux Password Command Line

Fig.01: passwd command in action

To see password status of any user account, enter:
# passwd -S userNameHere
# passwd -S vivek

Sample outputs:

vivek P 05/05/2012 0 99999 7 -1

The status information consists of 7 fields as follows:

  1. vivek : Account login name (username)
  2. P : This field indicates if the user account has a locked password (L), has no password (NP), or has a usable password (P)
  3. 05/05/2012 : Date of the last password change.
  4. 0 : Password expiry minimum age
  5. 99999 : Password expiry maximum age.
  6. 7 : Password expiry warning period.
  7. -1 : Inactivity period for the password (see chage command for more information).

To get more info about password aging for a specific user called vivek, enter:
# chage -l vivek

Chage command

Fig.01: chage command in action

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 7 comments… add one }
  • Paresh May 5, 2012, 3:37 pm


    U will prompted for password and U can change it! If you are doing it for somebody else, U need to be root!

  • bhushan October 12, 2012, 6:18 am

    Tried same, below is output, didn’t got “PS”
    [root@externvlab1280 ~]# passwd -S bhushan
    bhushan PS 2012-10-11 10 90 7 -1 (Password set, SHA512 crypt.)

  • Nivetha January 9, 2013, 5:09 pm

    itsssssssssss helps me at a valid time

  • m0r4 December 16, 2014, 3:17 pm


  • Richard LaFrance April 29, 2015, 5:55 pm

    Can’t set the password. I need an example. Can you help?

    • emmanuel July 8, 2015, 6:41 pm

      $ passwd
      this will prompt u to input the current password and then prompt u to change to the new password

  • Adi December 11, 2016, 4:10 pm

    how to disable user to change another user password?

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , ,