How to change root or user password

If you need to change the root password or a user password read this article.

In case you want to change your own password (even if your are root or not) you simply type

passwd

In case you want to change the password of another user simply type

passwd <user>

In both cases you will be prompted twice for the new password.

Below you can find some more info about passwd command

 The options which apply to the passwd command are:

       -a, --all
           This option can be used only with -S and causes show status for all
           users.

       -d, --delete
           Delete a user´s password (make it empty). This is a quick way to
           disable a password for an account. It will set the named account
           passwordless.

       -e, --expire
           Immediately expire an account´s password. This in effect can force
           a user to change his/her password at the user´s next login.

       -h, --help
           Display help message and exit.

       -i, --inactive INACTIVE
           This option is used to disable an account after the password has
           been expired for a number of days. After a user account has had an
           expired password for INACTIVE days, the user may no longer sign on
           to the account.

       -k, --keep-tokens
           Indicate password change should be performed only for expired
           authentication tokens (passwords). The user wishes to keep their
           non-expired tokens as before.

       -l, --lock
           Lock the password of the named account. This option disables a
           password by changing it to a value which matches no possible
           encrypted value (it adds a ´!´ at the beginning of the password).

           Note that this does not disable the account. The user may still be
           able to login using another authentication token (e.g. an SSH key).
           To disable the account, administrators should use usermod
           --expiredate 1 (this set the account´s expire date to Jan 2, 1970).

           Users with a locked password are not allowed to change their
           password.

       -m, --mindays MIN_DAYS
           Set the minimum number of days between password changes to
           MIN_DAYS. A value of zero for this field indicates that the user
           may change his/her password at any time.

       -q, --quiet
           Quiet mode.

       -r, --repository REPOSITORY
           change password in REPOSITORY repository

       -S, --status
           Display account status information. The status information consists
           of 7 fields. The first field is the user´s login name. The second
           field indicates if the user account is locked (L), has no password
           (NP), or has a usable password (P). The third field gives the date
           of the last password change. The next four fields are the minimum
           age, maximum age, warning period, and inactivity period for the
           password. These ages are expressed in days.

       -u, --unlock
           Unlock the password of the named account. This option re-enables a
           password by changing the password back to its previous value (to
           the value before using -l option, by removing the leading ´!´).

       -w, --warndays WARN_DAYS
           Set the number of days of warning before a password change is
           required. The WARN_DAYS option is the number of days prior to the
           password expiring that a user will be warned that his/her password
           is about to expire.

       -x, --maxdays MAX_DAYS
           Set the maximum number of days a password remains valid. After
           MAX_DAYS, the password is required to be changed.

Posted on: 10/12/2009








0 Comments
If you want to leave a comment please Login or Register
How to backup your data using rsync......
Understanding autoconf......
The Basics of fdisk......
Accessing Memory Using DMA......
The fd Directory......