Skip to content

Commit 80c5150

Browse files
authored
doc: update command/passwd.md (#600)
添加通过 echo 命令结合管道符来修改密码的例子。
1 parent 37bcd5f commit 80c5150

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

command/passwd.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ Retype new UNIX password: # 再输入一次;
8585
passwd: all authentication tokens updated successfully. # 成功;
8686
```
8787

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

9099
```shell

0 commit comments

Comments
 (0)