lpasswd - Unix, Linux Command



NAME

lpasswd - Change group or user password.

SYNOPSIS

  • lpasswd [OPTION]... [name]
  • DESCRIPTION

    lpasswd Changes password of user or group name.If the name argument is not provided, username of the invoking user is used; the name argument is ignored if lpasswd is run set-uid to a different user. Entering an empty password (by pressing Enter) aborts the password setting operation.

    Options

    Tag Description
    -F, --plainpassword-fd=fd Read password from file descriptor fd, terminated by end of file, '\r' or '\n'.
    -f, --password-fd=fd Read password hash from file descriptor fd, terminated by end of file, '\r' or '\n'.
    -g, --group Change password of group name. By default the password of user name is changed.
    -i, --interactive Ask all questions when connecting to the user database, even if default answers are set up in libuser configuration.
    -P, --plainpassword=password Set the password to password. Note that the password can be viewed while running lpasswd using tools such PS1
    -p, --password=encrypted Set the password to the password represented by the hash encrypted.

    EXAMPLES

    Example-1:

    Change Password of System Users:

    $ lpasswd

    output:

     Changing password for user ubuntu.
     Changing password for ubuntu.
     (current) UNIX password:
     New password:
     Retype new password:
     passwd: all authentication tokens updated successfully.
     
     Note: When you logged in as root user and run passwd command then it will reset the root
     password by default and if you specify the user-name after passwd command then it 
     will change the password of that user.
    
    # lpasswd
    # lpasswd ubuntu
    

    Example-2:

    Display Password Status Information:

    # lpasswd -S ubuntu

    output:

    linuxtechi PS 2017-01-20 0 99999 7 -1 (Password set, SHA512 crypt.)  

    Example-3:

    Removing Password of a User using -d option

    # lpasswd -d ubuntu

    output:

     Removing password for user ubuntu.
     passwd: Success
     
     # lpasswd -S ubuntu
     ubuntu NP 2017-01-20 0 99999 7 -1 (Empty password.) 

    Example-4:

    Set Password Expiry Immediately , ‘-e’ option in passwd command to expire user’s password immediately ,

    # lpasswd -e ubuntu

    output:

       Expiring password for user ubuntu
       passwd: Success
       
       # lpasswd -S ubuntu
       ubuntu PS 1970-01-01 0 99999 7 -1 (Password set, SHA512 crypt.)

    Example-5:

    Lock the password of System User

    # lpasswd -l ubuntu

    output:

     Locking password for user ubuntu.
     passwd: Success
     # lpasswd -S ubuntu
     LK 2017-01-20 0 99999 7 -1 (Password locked.)
    

    Example-6:

    Unlock User’s Password using -u option

    # lpasswd -u ubuntu

    output:

    Unlocking password for user ubuntu.
    passwd: Success 
    

    Example-7:

    Setting inactive days using -i option

    # lpasswd -i 10 ubuntu

    output:

    Adjusting aging data for user ubuntu.
    passwd: Success
    
    # lpasswd -S ubuntu
    ubuntuPS 2017-01-20 0 99999 7 10 (Password set, SHA512 crypt.)
    
    Advertisements