首页 > 系统服务 > 详细

linux --stdin 管道输出

时间:2019-08-06 13:51:33      阅读:139      评论:0      收藏:0      [点我收藏+]

--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 用户名

1
2
3
4
5
6
7
8
9
10
[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 ~]#

这种方式虽然简单,但是通过history命令可以查到用户的密码,所以不安全。

linux --stdin 管道输出

原文:https://www.cnblogs.com/chengfengchi/p/11308244.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!