{"id":830,"date":"2012-11-25T15:48:23","date_gmt":"2012-11-25T04:48:23","guid":{"rendered":"http:\/\/howden.net.au\/thowden\/?p=830"},"modified":"2012-11-25T15:48:23","modified_gmt":"2012-11-25T04:48:23","slug":"rsync-on-debian","status":"publish","type":"post","link":"https:\/\/howden.net.au\/thowden\/2012\/11\/rsync-on-debian\/","title":{"rendered":"Rsync on Debian"},"content":{"rendered":"<p>I&#8217;ve acquired a few more Linux servers recently with Debian Squeeze installed (version 6.0.6 according to #cat \/etc\/debian_version).<\/p>\n<p>Installing Rsync is easy:<\/p>\n<p>[bash]<br \/>\napt-get install rsync<br \/>\n[\/bash]<\/p>\n<p>The tricks are in getting the config files done, actually running the service, connecting, etc.<\/p>\n<p>The default config file is in \/etc\/default\/rsync\u00a0 which sets up how rsync will run.<\/p>\n<p>The default settings file is expected as \/etc\/rsync.conf\u00a0 which I change to set to \/etc\/rsyncd\/rsyncd.conf\u00a0\u00a0 just so I am clear which config is &#8216;mine&#8217; to work on.\u00a0 The actual change in the \/etc\/default\/rsync file is shown here with the RSYNC_CONFIG_FILE line enabled (removed the # at the start) and with the path setting as described.<\/p>\n<p>[text]<br \/>\n# which file should be used as the configuration file for rsync.<br \/>\n# This file is used instead of the default \/etc\/rsyncd.conf<br \/>\n# Warning: This option has no effect if the daemon is accessed<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 using a remote shell. When using a different file for<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 rsync you might want to symlink \/etc\/rsyncd.conf to<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 that file.<br \/>\nRSYNC_CONFIG_FILE=\/etc\/rsyncd\/rsyncd.conf<\/p>\n<p>[\/text]<\/p>\n<p>The other important bit is the Rsync is not enabled by default and is therefore not going to run or be running!\u00a0 In the same \/etc\/default\/rsync file edit the RSYNC_ENABLE option to change false to true<\/p>\n<p>[text]<br \/>\n# start rsync in daemon mode from init.d script?<br \/>\n#\u00a0 only allowed values are &quot;true&quot;, &quot;false&quot;, and &quot;inetd&quot;<br \/>\n#\u00a0 Use &quot;inetd&quot; if you want to start the rsyncd from inetd,<br \/>\n#\u00a0 all this does is prevent the init.d script from printing a message<br \/>\n#\u00a0 about not starting rsyncd (you still need to modify inetd&#8217;s config yourself).<br \/>\nRSYNC_ENABLE=true<br \/>\n#<br \/>\n#<br \/>\n[\/text]<br \/>\n[bash]<br \/>\n#service rsync restart<br \/>\n[\/bash]<\/p>\n<p>I used the restart command even though I knew that it was not running (yet) as I can reuse the command via Ctrl-R when I do more edits to the config settings<\/p>\n<p>[bash]<br \/>\n\/etc\/default# service rsync restart<br \/>\nRestarting rsync daemon: rsyncrsync daemon not running, attempting to start. &#8230; (warning).<br \/>\nmissing or empty config file \/etc\/rsyncd\/rsyncd.conf &#8230; failed!<br \/>\nfailed!<br \/>\n\/etc\/default#<br \/>\n[\/bash]<\/p>\n<p>And as expected there is a warning that it was not running to be able to stop it, and then the start action fails as there is no config file, as yet.<\/p>\n<p>So that is all good.<\/p>\n<p>Next create the appropriate config file. Easiest to start with the example conf file from the default install<\/p>\n<p>[bash]<br \/>\n\/etc\/rsyncd\/# cp \/usr\/share\/doc\/rsync\/examples\/rsyncd.conf .<br \/>\n[\/bash]<\/p>\n<p>Then edit it&#8230;<\/p>\n<p>[text]<br \/>\n# sample rsyncd.conf configuration file<br \/>\n# GLOBAL OPTIONS<br \/>\n#motd file=\/etc\/motd<br \/>\nlog file=\/var\/log\/rsyncd<br \/>\n# for pid file, do not use \/var\/run\/rsync.pid if<br \/>\n# you are going to run rsync out of the init.d script.<br \/>\n# pid file=\/var\/run\/rsyncd.pid<br \/>\n#syslog facility=daemon<br \/>\n#socket options=<br \/>\n[\/text]<\/p>\n<p>The sections in the config file are based on the sample config file and in the top Global Options I only check that the log file path is correct and enabled<\/p>\n<p>For each backup set that is going to be inbound to this server I add a new section to the config file:<\/p>\n<p>[text]<br \/>\n# MODULE OPTIONS<\/p>\n<p>[ftp]<br \/>\n        comment = public archive          &lt;&#8211; a clever comment<br \/>\n        path = \/var\/www\/pub               &lt;&#8211; set the path<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0  use chroot = yes<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0  max connections=10                &lt;&#8211; do not set it to 1<br \/>\n        lock file = \/var\/lock\/rsyncd<br \/>\n# the default for read only is yes&#8230;<br \/>\n        read only = yes                   &lt;&#8211; change this to no so source files can be written<br \/>\n        list = yes<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0uid = nobody                      &lt;&#8211; the username for the newly uploaded files<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  gid = nogroup                     &lt;&#8211; the group for the files<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 exclude =<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 exclude from =<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 include =<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 include from =<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 auth users =                      &lt;&#8211; comma space delimited list of names that appear in the secrets file<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 secrets file =\/etc\/rsyncd.secrets &lt;&#8211; a text file with a username:password<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 strict modes = yes<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 hosts allow =                     &lt;&#8211; ip address for the source system<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 hosts deny =<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ignore errors = no<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ignore nonreadable = yes<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0transfer logging = no<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0timeout = 600<br \/>\n        refuse options = checksum dry-run<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz<br \/>\n[\/text]<\/p>\n<p>and after each update to the config file restart the service to load the new config and confirm that Rsync will run with it.<\/p>\n<p>[bash]<br \/>\n\/etc\/default# service rsync restart<br \/>\n[\/bash]<\/p>\n<p>I&#8217;ve not looked at SSH \/ SSL type connections for Rsync\u00a0in this.\u00a0The main thing was to get Rsync setup as a server and control the inbound traffic based on accounts, servers, and ip restrictions.<\/p>\n<p>Another post will update SSH configuration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve acquired a few more Linux servers recently with Debian Squeeze installed (version 6.0.6 according to #cat \/etc\/debian_version). Installing Rsync is easy: [bash] apt-get install rsync [\/bash] The tricks are in getting the config files done, actually running the service, connecting, etc. The default config file is in \/etc\/default\/rsync\u00a0 which sets up how rsync will [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,13,34],"tags":[],"class_list":["post-830","post","type-post","status-publish","format-standard","hentry","category-linux-servers-and-software","category-rsync","category-rsync-windows-servers"],"_links":{"self":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/comments?post=830"}],"version-history":[{"count":0,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/830\/revisions"}],"wp:attachment":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/media?parent=830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/categories?post=830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/tags?post=830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}