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.
- 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
转载于:https://blog.51cto.com/151wqooo/1169233
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)