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)
如何使用这些命令?输入这些命令时没有响应,只是再次显示相同的内容。
例如当我输入
passwd -d Madhu G
没有回应或错误。
答案1
所有linux命令都有相同的结构语法书写
command [-options] [attr]
并且 passwd 不是其他的
passwd [options] [LOGIN]
例如,我将列出一些选项的用途
使用 -d 选项删除(清空)账户密码
$ sudo passwd -d guest
passwd: password expiry information changed.
现在针对你上面的情况首先你不要使用sudo
,还要确保使用正确的用户名 Madhu G
?因为我不认为你可以在用户名之间留有空格
另一个示例使用 -e 选项使帐户密码过期
$ sudo passwd -e guest
passwd: password expiry information changed.
答案2
你的命令是错误的。
passwd -d Madhu G
passwd
接受这一点:
passwd [options] [LOGIN]
您的命令偏离了此要求,因此将显示可能的参数列表:
$ 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
语法正确,但仍然错误,因为有空格而不是小写:
sudo passwd -d "Madhu G"
为了你的利益(坏主意)
sudo passwd -d "$USER"
或其他登录名(不带空格且小写):
sudo passwd -d <username>