{"id":711,"date":"2013-12-14T18:58:40","date_gmt":"2013-12-14T23:58:40","guid":{"rendered":"http:\/\/blog.xfloyd.net\/?p=711"},"modified":"2014-12-20T11:02:43","modified_gmt":"2014-12-20T16:02:43","slug":"rsync-over-ssh-with-sudo-to-preserve-permissions-and-user","status":"publish","type":"post","link":"https:\/\/xfloyd.net\/blog\/?p=711","title":{"rendered":"RSYNC over ssh with sudo to preserve permissions and ownership"},"content":{"rendered":"<p>See this post first as it&#8217;s the first step to this setup:<br \/>\n<a title=\"Steps to Perform SSH Login Without Password Using ssh-keygen &amp; ssh-copy-id\" href=\"http:\/\/blog.xfloyd.net\/?p=705\">Steps to Perform SSH Login Without Password Using ssh-keygen &amp; ssh-copy-id<\/a><\/p>\n<p>#sudo visudo on the terget box<\/p>\n<p>at the bottom add:<\/p>\n<pre>username_that_logs_in_to_ssh_from_source ALL=NOPASSWD: \/usr\/bin\/rsync<\/pre>\n<p>to your rsync command add:<\/p>\n<pre>--rsync-path=\"sudo rsync\"<\/pre>\n<p>full example:<\/p>\n<pre>rsync -avz --delete --rsync-path=\"sudo rsync\" \/var\/www\/sites\/ target_host:\/var\/www\/sites\/<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>See this post first as it&#8217;s the first step to this setup: Steps to Perform SSH Login Without Password Using ssh-keygen &amp; ssh-copy-id #sudo visudo on the terget box at the bottom add: username_that_logs_in_to_ssh_from_source ALL=NOPASSWD: \/usr\/bin\/rsync to your rsync command add: &#8211;rsync-path=&#8221;sudo rsync&#8221; full example: rsync -avz &#8211;delete &#8211;rsync-path=&#8221;sudo rsync&#8221; \/var\/www\/sites\/ target_host:\/var\/www\/sites\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/711"}],"collection":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=711"}],"version-history":[{"count":6,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/711\/revisions"}],"predecessor-version":[{"id":717,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/711\/revisions\/717"}],"wp:attachment":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}