linux --stdin 管道 标准输入重定向
linux --stdin 标准输入重定向
--stdin
This option is used to indicate that passwd should read the new password from standard input, which can be a pipe.
这个选项用于从标准输入管道读入新的密码。
使用 echo 方式来重置Linux 系统用户密码:
echo “新密码”|passwd --stdin 用户名
点击查看代码
[root@rhel7 ~]# passwd --stdin rusky 为rusky用户设置密码。
Changing password for user rusky.
zxcvbnm
passwd: all authentication tokens updated successfully.
[root@rhel7 ~]# echo "qwert"
qwert
[root@rhel7 ~]# echo "qwert" | passwd --stdin rusky 把echo返回的字符qwert设置为用户rusky的密码
Changing password for user rusky.
passwd: all authentication tokens updated successfully.
[root@rhel7 ~]#

浙公网安备 33010602011771号