shell脚本中自动输入密码

来源:互联网 发布:传奇账号数据库 编辑:程序博客网 时间:2024/05/17 05:03
在shell脚本中需要用root用的来执行指令:
sudo 自动输入密码

echo "password" | sudo -S netstat -tlnp

       -S          
The -S (stdin) option causes sudo to read the password from the standard input instead of the terminal device.
0 0
原创粉丝点击