现在的位置: 首页 > 综合 > 正文

shell 自动输入密码

2013年07月12日 ⁄ 综合 ⁄ 共 224字 ⁄ 字号 评论关闭

原文地址:http://biancheng.dnbcw.info/linux/297018.html

在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.

抱歉!评论已关闭.