doc: update command/passwd.md (#600)

添加通过 echo 命令结合管道符来修改密码的例子。
This commit is contained in:
zyy2477 2024-09-01 15:57:44 +08:00 committed by GitHub
parent 37bcd5ff8f
commit 80c5150c92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -85,6 +85,15 @@ Retype new UNIX password: # 再输入一次;
passwd: all authentication tokens updated successfully. # 成功;
```
或通过管道符把`echo`命令和`passwd`命令的`--stdin`参数相结合,用一条命令来完成密码修改,无序交互。
以 linuxde 用户的密码改成 123456 为例:
```shell
[root@localhost ~]# echo "123456" | passwd --stdin linuxde
Changing password for user linuxde. # 正在更改 linuxde 用户的密码。
passwd: all authentication tokens updated successfully. # passwd所有身份验证令牌都已成功更新
```
普通用户如果想更改自己的密码直接运行passwd即可比如当前操作的用户是linuxde。
```shell