<input type="hidden" id="_wpnonce" name="_wpnonce" value="ca3c62ece8" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/5376" /><input type="hidden" id="_wpnonce" name="_wpnonce" value="ca3c62ece8" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/5376" />{"id":5376,"date":"2016-08-08T13:51:22","date_gmt":"2016-08-08T03:51:22","guid":{"rendered":"https:\/\/www.businesslegions.com\/blog\/?p=5376"},"modified":"2023-11-16T18:15:26","modified_gmt":"2023-11-16T07:15:26","slug":"setting-rsync-file-synchronisation","status":"publish","type":"post","link":"https:\/\/www.businesslegions.com\/blog\/2016\/08\/08\/setting-rsync-file-synchronisation\/","title":{"rendered":"SETTING UP RSYNC FOR FILE SYNCHRONISATION"},"content":{"rendered":"<!--CusAds0--><p>The first thing to do is check to see whether you have rsync installed on your VPS. Just type rsync. If it comes back with:<\/p>\n<p><em>[root@test ~]# rsync<\/em><br \/>\n<em> rsync version 3.0.6 protocol version 30<\/em><br \/>\n<em> Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.<\/em><br \/>\n<em> Web site: rsync.samba.org\/<\/em><br \/>\n<em> Capabilities:<\/em><br \/>\n<em> 64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,<\/em><br \/>\n<em> socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,<\/em><br \/>\n<em> append, ACLs, xattrs, iconv, symtimes<\/em><\/p>\n<p><em>rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you<\/em><br \/>\n<em>are welcome to redistribute it under certain conditions. See the GNU<\/em><br \/>\n<em> General Public Licence for details.<\/em><\/p>\n<p>Then you know rsync is installed. If it returns an invalid command then you know you need to install it. To install rsync just use the following command:<\/p>\n<pre class=\"lang:default decode:true \">yum -y install rsync<\/pre>\n<p>&nbsp;<\/p>\n<p>Generate the SSH key gen for a password-less login<\/p>\n<pre class=\"\">ssh-keygen -t rsa<\/pre>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-5397\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen.png?strip=all\" alt=\"Rsync SSH Keygen\" width=\"560\" height=\"318\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen.png?strip=all 560w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-300x170.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-178x101.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen.png?strip=all&amp;w=112 112w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen.png?strip=all&amp;w=448 448w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/p>\n<p>Accept all default settings<\/p>\n<p>Copy the ssh keys to the remote server<\/p>\n<pre class=\"lang:default decode:true\">ssh-copy-id user@x.x.x.x<\/pre>\n<p>or paste the keys in ssh:<\/p><!--CusAds0-->\n<pre class=\"lang:default decode:true \">cat .ssh\/id_rsa.pub | ssh root@x.x.x.x\u00a0'cat &gt;&gt; .ssh\/authorized_keys'<\/pre>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-5398\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-authorised.png?strip=all\" alt=\"Rsync SSH Keygen authorised\" width=\"641\" height=\"44\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-authorised.png?strip=all 641w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-authorised-300x21.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-authorised-178x12.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-authorised.png?strip=all&amp;w=128 128w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-authorised.png?strip=all&amp;w=384 384w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-authorised.png?strip=all&amp;w=512 512w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2016\/08\/Rsync-SSH-Keygen-authorised.png?strip=all&amp;w=450 450w\" sizes=\"(max-width: 641px) 100vw, 641px\" \/><\/p>\n<p>Then run the rsync to synchronise the files. It&#8217;s always from source to destination so the below command needs to run from the server that you have the files you wish to copy.<\/p>\n<pre>rsync -avuzr --update --delete --rsync-path=\/usr\/bin\/rsync \/web\/backups\/ root@xxx:\/web\/backups<\/pre>\n<p>If you encounter the following error message when you run RSYNC then proceed reading to see the solution:<\/p>\n<p><em>bash: \/usr\/bin\/rsync: No such file or directory<\/em><br \/>\n<em> rsync: connection unexpectedly closed (0 bytes received so far) [sender]<\/em><br \/>\n<em> rsync error: remote command not found (code 127) at io.c(600) [sender=3.0.6]<\/em><\/p>\n<p>The fix was to install rsync on the remote server. You may have read in a few articles that rsync is not required on the remote server but in my case it was needed. It was the only way to fix the problem.<\/p>\n<div class=\"lt-box\" style=\"border:1px solid #1d6a9e\"><div class=\"lt-box-title\" style=\"background-color:#2485C6;border-top:1px solid #a7cee8;text-shadow:1px 1px 0 #0b283b\">DO YOU LIKE WHAT YOU'VE READ?<\/div><div class=\"lt-box-content\">Join our subscription list and receive our content right in your mailbox. If you like to receive some Great deals our Freebies then subscribe now!\r\n\r\n<p><div class=\"tnp tnp-subscription \">\n<form method=\"post\" action=\"https:\/\/www.businesslegions.com\/blog\/wp-admin\/admin-ajax.php?action=tnp&amp;na=s\">\n<input type=\"hidden\" name=\"nlang\" value=\"\">\n<div class=\"tnp-field tnp-field-firstname\"><label for=\"tnp-1\">Name<\/label>\n<input class=\"tnp-name\" type=\"text\" name=\"nn\" id=\"tnp-1\" value=\"\" placeholder=\"\"><\/div>\n<div class=\"tnp-field tnp-field-email\"><label for=\"tnp-2\">Email<\/label>\n<input class=\"tnp-email\" type=\"email\" name=\"ne\" id=\"tnp-2\" value=\"\" placeholder=\"\" required><\/div>\n<div class=\"tnp-field tnp-field-button\" style=\"text-align: left\"><input class=\"tnp-submit\" type=\"submit\" value=\"Subscribe\" style=\"\">\n<\/div>\n<\/form>\n<\/div>\n<\/p>\r\n\r\n<\/div><\/div><!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>The first thing to do is check to see whether you have rsync installed on your VPS. Just type rsync. If it comes back with: [root@test ~]# rsync rsync version 3.0.6 protocol version 30 Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others. Web site: rsync.samba.org\/ Capabilities: 64-bit files, 64-bit inums, 64-bit timestamps, 64-bit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5400,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1043,1895],"tags":[1836,1973,2529,306,2530,57,307,303],"class_list":["post-5376","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","category-websites","category-windows","tag-centos","tag-files","tag-rsync","tag-server","tag-synch","tag-synchronise","tag-virtual-private-server","tag-vps"],"_links":{"self":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/5376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/comments?post=5376"}],"version-history":[{"count":10,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/5376\/revisions"}],"predecessor-version":[{"id":38446,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/5376\/revisions\/38446"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media\/5400"}],"wp:attachment":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media?parent=5376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/categories?post=5376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/tags?post=5376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}