{"id":2182,"date":"2013-10-24T11:31:40","date_gmt":"2013-10-24T03:31:40","guid":{"rendered":"http:\/\/kuki.idv.tw\/?p=2182"},"modified":"2013-10-24T11:31:40","modified_gmt":"2013-10-24T03:31:40","slug":"debian-rsyncd-%e5%ae%89%e8%a3%9d","status":"publish","type":"post","link":"https:\/\/www.kuki.idv.tw\/?p=2182","title":{"rendered":"debian rsyncd \u5b89\u88dd"},"content":{"rendered":"<p>\u53c3\u8003\u8cc7\u6599<\/p>\n<p><a href=\"http:\/\/www.linuxawy.org\/node\/12\">http:\/\/www.linuxawy.org\/node\/12<\/a><\/p>\n<div id=\"node-12\">\n<div>\n<p dir=\"LTR\">rsync is a great tool for synchronizing 2 directories (or files) either one of them is remote and the other is local, or 2 local folders (it doesn&#8217;t support synchronizing 2 remote servers, yet). the power of rsync comes from that it doesn&#8217;t transfer anything unless it detects that it&#8217;s changes since last run. moreover, it transfer the changes in files only (unless you specified otherwise), and it can even compress files before sending which makes it ideal for continuous backups and mirroring.<\/p>\n<p dir=\"LTR\">to use rsync, you have 2 options. either to start rsync daemon which handles the connections, or use it through ssh tunnel. each way has its positives and negatives. rsync daemon is indeed faster in intiating connections cause it doesn&#8217;t exchange keys or encrypt data, which makes its load on the server is less too. the overhead of keeping the daemon alive is so small that you can simply ignore. the ssh tunnel doesn&#8217;t require a special configuration on the server side, but you must have ssh access to the server, which means that you can&#8217;t grant anonymouse access to your data. the main positive of ssh tunnel is that data is sent through the secure tunnel and can&#8217;t be sniffed.<\/p>\n<ol dir=\"LTR\">\n<li dir=\"LTR\">to connect through ssh tunnel: first, you&#8217;ll need to install rsync:<br \/>\n<code>apt-get install rsync<\/code><br \/>\nthen you are ready, just issue the command directly<br \/>\n<code>rsync -avz -e ssh remoteuser@remotehost:\/remote\/dir \/this\/dir\/<br \/>\n<\/code>remember to check the permissions for ssh user on the remote server. (the remote server must have rsync installed too).<\/li>\n<li dir=\"LTR\">to connect through rsync server:\n<ol dir=\"LTR\">\n<li dir=\"LTR\">install rsync:<br \/>\n<code>apt-get install rsync<\/code><\/li>\n<li dir=\"LTR\">create &#8220;<code>\/etc\/rsyncd.conf<\/code>&#8221; and put the following in it:<br \/>\n<code>max connections = 1<br \/>\nlog file = \/var\/log\/rsync.log<br \/>\ntimeout = 300<br \/>\n[cache]<br \/>\ncomment = Cache of Mongrels<br \/>\npath = \/usr\/local\/cache<br \/>\nread only = no<br \/>\nlist = yes<br \/>\nuid = nobody<br \/>\ngid = nogroup<br \/>\n#auth users = mongrel<br \/>\nlist = yes<br \/>\nhosts allow = 127.0.0.0\/8 192.168.0.0\/24<br \/>\n#secrets file = \/etc\/rsyncd.secrets<\/code><\/p>\n<p>note that the first few lines are global (for all modules) and the other one is specital for the public module.<br \/>\ncomment the last two lines to grant anonymouse access, note that you can still limit by ip\/netmask<\/li>\n<li dir=\"LTR\">create &#8221;\/etc\/rsyncd.secret&#8221;, and put the usernames and passwords for the ones who can access rsync, in the form of username:password , note that passwords are saved here as clear text. so don&#8217;t forget to chmod it to 400 to keep the passwords somehow safe<\/li>\n<li dir=\"LTR\">make rsync to start as daemon:<br \/>\nedit &#8221;\/etc\/inetd.conf&#8221; and put the following line in the end:<br \/>\nrsync stream tcp nowait root \/usr\/bin\/rsync rsync &#8211;daemon<\/li>\n<li dir=\"LTR\">voila, you are done, test your settings by typing:<br \/>\n<code>rsync rsync:\/\/your_ip_or_domain_name\/<\/code><br \/>\nthis should list the modules<br \/>\n<code>rsync rsync:\/\/your_ip_or_domain_name\/public<\/code><br \/>\nthis shuold list the files in your &#8216;public&#8217; modules<br \/>\n<code>rsync -avz rsync:\/\/your_ip_or_domain_name\/public<\/code><br \/>\nsynchronozing should start the transfer now.<br \/>\ndon&#8217;t forget to check the rsync man page to check what flags do you really need.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u53c3\u8003\u8cc7\u6599 http:\/\/www.linuxawy.org\/node\/12 rsync is a great t &hellip; <a href=\"https:\/\/www.kuki.idv.tw\/?p=2182\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008debian rsyncd \u5b89\u88dd\u3009<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2182"}],"collection":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2182"}],"version-history":[{"count":2,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2182\/revisions"}],"predecessor-version":[{"id":2184,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2182\/revisions\/2184"}],"wp:attachment":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}