root 権éã®å¿ è¦ãªãã£ã¬ã¯ããªã«å¯¾ãã¦rsync ãã
CentOS ã®Apache ã§DocumentRoot ã¨ããã¦ãã/var/www/html ããµã¼ãéã§åæããããã«
% rsync -avz -e ssh --delete /var/www/html [email protected]:/var/www/html
ã¨rsync ãå®è¡ãã¦ããfoo ã«/var/www/html ã¸ã®æ¸ãè¾¼ã¿æ¨©éããªãããæåããªãã
# PermitRootLogin yes ãªæ¹ã¯åæã«ã©ããã
NFS ã使ããã°æã£åãæ©ãã®ã ããä¸ã¤ã®è§£æ±ºçã¨ãã¦
example.com ã«ä»¥ä¸ã®ã¹ã¯ãªãããç½®ã(/home/foo/rsync.sh ã¨ãã)
#!/bin/sh /usr/bin/sudo /usr/bin/rsync $*
visudo ã§
foo ALL=(ALL) NOPASSWD: /usr/bin/rsync
ã¨è¨å®ãã¦ããã
ãã¨ã¯rsync ã³ãã³ãã« --rsync-path ãã¤ãã¦å®è¡ãããã¨ã§
% rsync -avz -e ssh --delete --rsync-path="/home/foo/rsync.sh" /var/www/html [email protected]:/var/www/html
example.com å´ã§ã¯sudo ããrsync ãèµ°ãã/var/www/html 以ä¸ã«æ¸ãè¾¼ã¿ãã§ããã
æ·±å¤ã«ç¸è«ã«ä¹ã£ã¦ãããhasegaw blog ã®ä¸ã®äººã«æè¬ã