rsync使用sudo權限


1、在etc/sudoers增加,比如www-data這個賬戶的

www-data ALL=NOPASSWD:/usr/bin/rsync

2、使用時增加--rsync-path="sudo rsync"

rsync -avh --rsync-path="sudo rsync" /etc/profiled.d/java.sh www-data@192.168.5.10:/etc/profiled.d/

 

參考:

https://superuser.com/questions/270911/run-rsync-with-root-permission-on-remote-machine

https://unix.stackexchange.com/questions/92123/rsync-all-files-of-remote-machine-over-ssh-without-root-user/92397#92397


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM