您的位置:首页 > 运维架构 > Shell

shell脚本中自动输入密码

2014-08-09 10:12 260 查看
在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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: