How To Ideas | How To Articles | How To Tutorials


0

The passwd Command – Terminal


passwd is command or tool in Unix/Linux-based operating systems which enables the user to change or configure Password of a User account. The password entered by user is run through a Key Derivation Function which converts the plain text to equivalent hash which is encrypted one. Original password is not saved anywhere for security reasons, only this hashed version of new password is stored in /etc/passwd file. Hashed version of plain text is usually calculated by using DES algorithm.

*** Note all the following information is tested on Ubuntu 11.10. We endeavor to keep the information up-to-date and correct, However, we cannot guarantee that information given on the site is accurate or up to date.

Syntax  : passwd [options] [LOGIN]

Here LOGIN is the user-id whose password you want to change. If you want to change password of current user account, then there is no need to mention you user-id, but if you want to change password information of another user’s account, then you have to mention user-id.

Following table shows all the available Options which you can use to configure password of a user account with passwd command/tool.

Option Available

Working

-a, –all

report password status on all accounts

can be used with -S option only

-d, –delete

delete the password for the named account

-e, –expire

force expire the password for the named account

-r, –repository REPOSITORY

change password in REPOSITORY repository

Available Repositories : files, nis or nisplus.

-l, –lock

lock the password of the named account

-S, –status

report password status on the named account

Here are some of the working examples of this command

  1. Changing the password of current account without using any option
    For this you can refer to another article which can be found here.
  2. Changing the password of current account without using any option
    Type in the following command to change password for another user’s account. For this you must have Super User rights, otherwise it will show an error “You may not view or modify password information for [user-id]“. In the following example, I am changing password of the User account with user-id howtoideas.

    sudo passwd howtoideas

    It will ask you the password of the current account to use sudo command and then it will ask you to enter new password of the other user account twice, and then it will show you an output message as shown in following image.

    Change Password of another account

    Change Password of another account

  3. Deleting password using -d option
    Next time your Operating System will not ask for a password to log into this account. In the following example I am changing the deleting the password of howtoideas user account. If you want to delete password of your own account, then there is no need to add user-id at the end of command.

    sudo passwd -d howtoideas

    Here is an image of the tested command.

    Delete Password

    Delete Password

  4. Forcefully expires the password of a user account using -e option
    This will expire the current password of the user account and next time when this user tries to log into his account, System will ask the user to enter new password as enforced by root. Following command will expire the password of howtoideasuser account.

    sudo passwd -e howtoideas

    Following image shows the working of this command.

    Password Expiration Information Change

    Change Password Expiration Information

    In following image, I am trying to log into howtoideas account, and see Terminal is asking to change the current password as enforced by root.

    Change password root enforced

    Change password root enforced

  5. Lock account password using -l option
    This option will lock the user account password and user will not be able to log into his account even after providing correct information. In the following command I am locking the howtoideasuser account password.

    sudo passwd -l howtoideas

    Following image shows the output of upper command.

    lock user account password

    lock user account password

    Now if i try to log into howtoideas account, I won’t be able to do so, even after providing correct password as shown in the following image.

    Locked Password

    Locked Account Password

  6. Checking status of a particular account or all the accounts using -S option
    This option will show the status information of a user account. The information shown is in the following order

    name status mm/dd/yy min max warn

    name The login ID of the user.
    status Status of the name:
    PS or P = Password Enabled account
    LK or L = Locked
    NP = No Password
    NL = No login account
    mm/dd/yy The month date and year that the password was last changed.
    min The minimum number of days between password changes.
    max The maximum number of days the password is valid for the name.
    warn The number of days relative to max before the passwd uses pam for password management.

    Following command will showing the information of howtoideas account.

    sudo passwd -S howtoideas

    Following image shows the output of upper command. See the L character in image after howtoideas in the output which shows that the account is locked. This is because in previous point I locked this account for example purpose.

    Locked account Information

    Locked account Information


  7. Checking status of a particular account or all the accounts using -S and -a Following command will output the password status information of all the account present in the system.

    sudo passwd -S -a

    Following image shows the output of upper command

    Password status of all accounts

    Password Status Information of all user accounts

Incoming search terms:

  • internet terminal password (1)
Filed in: Unix Terminal Tags: , , , , , , , , , , , , , , , ,

Leave a Reply

Submit Comment



© 2012 How To Ideas. All rights reserved.
Proudly designed by Theme Junkie.