+ -
当前位置:首页 → 问答吧 → 如何将交互式shell中的password隐藏

如何将交互式shell中的password隐藏

时间:2011-04-28

来源:互联网

  1. #!/bin/sh
  2. #change username here
  3. echo "This is a automatic shell for changing use password!"
  4. echo -n "Please Input Username:"
  5. read USERNAME;
  6. echo -n "Please Input New User Password:"
  7. read PASSWORD;
  8. 。。。。。。。。。。。。。
复制代码
写在简单的shell修改用户ftp密码,现在在交互过程中用户输入的密码是明文的,如何变成如:******的password形式?
谢谢!

作者: toseeme_cu   发布时间: 2011-04-28

本帖最后由 expert1 于 2011-04-28 11:03 编辑

回复 toseeme_cu


    我也想知道办法

作者: expert1   发布时间: 2011-04-28

回复 Shell_HAT


    :mrgreen: 斑竹你真是shell的百事通啊。

作者: expert1   发布时间: 2011-04-28

read -s
不过没有“****”,不太符合要求……
还有,PASSWORD变量不能当做参数传递,不然ps -ef就可以看到

作者: dzhxc   发布时间: 2011-04-28

谢谢,我测试测试

作者: toseeme_cu   发布时间: 2011-04-28

mark一下,虽然暂时用不到shell了,但是谁知道以后会不会用到呢?

作者: lictans   发布时间: 2011-04-28