Linux-password

How to change the User Password In Linux via Commandline

by Dan

Linux-passwordIt is really simple to change the password for specific user on various Linux distros like Ubuntu,Fedora,Linux Mint,Debian etc.

Note that If you are a normal user then you can only change your password only and Super User or Administrator can change password for any user in a system.

Login as a root using the following command

$ sudo -s

Now to change the password for a user named “vividvilla” execute the following command

$ passwd vivek

Now you will be prompted to enter new password for the specified user
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Now to see what you can do with the passwd command execute the following

$ passwd -help

you will get to see something like below

Options:
-a, --all                     report password status on all accounts
-d, --delete                  delete the password for the named account
-e, --expire                  force expire the password for the named account
-h, --help                    display this help message and exit
-k, --keep-tokens             change password only if expired
-i, --inactive INACTIVE       set password inactive after expiration
to INACTIVE
-l, --lock                    lock the password of the named account
-n, --mindays MIN_DAYS        set minimum number of days before password
change to MIN_DAYS
-q, --quiet                   quiet mode
-r, --repository REPOSITORY   change password in REPOSITORY repository
-S, --status                  report password status on the named account
-u, --unlock                  unlock the password of the named account
-w, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
-x, --maxdays MAX_DAYS        set maximum number of days before password
change to MAX_DAYS

Now  lets check the status of the user “vividvilla”

$ passwd -S vividvilla

the  output will be
vividvilla P 06/07/2012 0 99999 7 -1

From the above output you can find that the last password change occurred on 06/07/2012

Related Posts