How to use options in passwd command

OPTIONS -d, --delete delete the password for the named account (root only) -f, --force force operation (effectively calls `chfn'?) -k, --keep-tokens keep non-expired authentication tokens -l, --lock lock the named account (root only) -S, --status report password status on the named account (root only) --stdin read new tokens from stdin (root only) -u, --unlock unlock the named account (root only)

How to use these commands? when type these command there is no response its just displaying the same thing again.

For example when I type

passwd -d Madhu G

there is no response or error.

2

2 Answers

All linux command has the same structural syntax writing

command [-options] [attr]

and passwd is not else

passwd [options] [LOGIN]

So for example I'm gonna list some uses of options

Delete(make it empty) an account password using the -d option

$ sudo passwd -d guest
passwd: password expiry information changed.

Now for your case above first you dont' use sudo and also be sure of using correct user name Madhu G? Since I dont think that you can have a username with space between

Another Example expire the account password using -e option

$ sudo passwd -e guest
passwd: password expiry information changed.
2

Your command is wrong.

passwd -d Madhu G

passwd accepts this:

passwd [options] [LOGIN]

Your command deviates from this requirement and, therefore, a list of possible parameters will be displayed:

$ passwd -d Madhu G
Usage: passwd [options] [LOGIN]
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 -R, --root CHROOT_DIR directory to chroot into -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

Correct syntax, but still wrong because with space and not lowercase:

sudo passwd -d "Madhu G"

For your account (bad idea)

sudo passwd -d "$USER"

or for another login name (without spaces and with lowercase):

sudo passwd -d <username>

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like