商务合作加Q:411239339

Linux下让sudo 无交互输入密码

浏览:255次阅读
没有评论

共计 493 个字符,预计需要花费 2 分钟才能阅读完成。

使用 - S 参数           

The -S (stdin) option causes sudo to read the password from the standard input instead of the terminal device.

改变文件权限:

echo "password" | sudo -S netstat -tlnp
echo "123456" | sudo -S chmod 777 test

rsync 数据同步


第一种方式:

echo "123456" | sudo -S /usr/bin/rsync -vzrtopg --progress --delete --password-file=/etc/rsyncd.secrets root@192.168.10.100::home  /home/vmail

第二种方式

sudo /usr/bin/rsync -vzrtopg --progress --delete --password-file=/etc/rsyncd.secrets root@192.168.10.100::home  /home/vmail << EOF  
123465  
EOF

正文完
扫码赞助
post-qrcode
 0
果子
版权声明:本站原创文章,由 果子 于2018-04-17发表,共计493字。
转载说明:除特殊说明外本站文章皆由果较瘦原创发布,转载请注明出处。
评论(没有评论)