passwd命令:

update user’s authentication tokens

更改用户密码

语法:

passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [username]

选项:

--stdin 从标准输入中获取密码(重要)

-d 删除密码

-f 强制执行

-l 停止使用

-u 启用被停用的用户

-x 设置密码有效期

-g 修改群组密码

-i 密码过期后停用用户

实例

[root@www ~]# echo "123456" | passwd --stdin maliu
Changing password for user maliu.
passwd: all authentication tokens updated successfully.