Mac: Rsync Backup

From ReceptiveIT
Jump to: navigation, search

This is a quick and dirty howto to create a functioning rsync daemon on Mac OSX. It will be refined at a later date

Configure Rsync

Create an /etc/rsyncd.conf

#====rsyncd.conf=========
secrets file = /etc/rsyncd.secrets
read only = no
list = yes 
uid = root
gid = wheel
timeout = 300
strict modes = false

[backup]
auth users = backup
path = /Volumes/External/BACKUP

Create an /etc/rsyncd.sercrets

backup:pass1234

Change the ownership of the file to not be world readable

> sudo chmod 640 /etc/rsync.secrets

Create the backup folder on your external hard drive

> sudo mkdir /Volumes/External/BACKUP

Create a /System/Library/LaunchDaemons/rsync.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
       <key>Disabled</key>
       <false/>
       <key>Label</key>
       <string>rsync</string>
       <key>Program</key>
       <string>/usr/bin/rsync</string>
       <key>ProgramArguments</key>
       <array>
               <string>/usr/bin/rsync</string>
               <string>--daemon</string>
       </array>
       <key>inetdCompatibility</key>
       <dict>
               <key>Wait</key>
               <false/>
       </dict>
               <key>Sockets</key>
               <dict>
                       <key>Listeners</key>
                       <dict>
                               <key>SockServiceName</key>
                               <string>rsync</string>
                               <key>SockType</key>
                               <string>stream</string>
                       </dict>
               </dict>
</dict>
</plist>

Start the service

>sudo launchctl load /System/Library/LaunchDaemons/rsync.plist