You may have different devices that you want to sync. The instructions below work on *nix computers, but for instance dlna services can be accessed from any enabled client, such as an android device. It also worked in the past with cygwin on Windows, but hasn't been tested lately.


Clients can use the backup script and JSON configuration file from this repo:

git clone

Let us look at the example configuration:

    "command" : "rsync",
    "options" : [
        "--rsh=/usr/bin/ssh -i /home/birdman/.ssh/mybox-homeserver-rsync",
    "remote_host" : "shisharka_server",
    "direction" : ">",
    "mail" : false,
    "mail_profiles_dir" : "/home/birdman/.thunderbird",
    "mail_dest" : "bird/userdata/",
    "mode" : "daemon",
    "locations" :[
            "src" : "/mnt/data/Projects",
            "dest" : "bird/projects"
        }, {
            "src" : "~/.bashrc",
            "dest" : "bird/dotfiles/"
        }, {
            "src" : "~/.tmux.conf",
            "dest" : "bird/dotfiles/"
        }, {
            "src" : "/mnt/data/music,
            "dest" : "music"
  • command at the moment is only rsync.
  • options are additional command-line options to pass to rsync
    • note the --rsh option. This specifies ssh as the remote shell, passing in the key to be used (see ssh for more details)
    • port the rsync daemon runs on a custom port on the server
  • remote_host: IP or hostname to sync to
  • direction: if this equals '<' then source and destination are swapped. This is simply for recycling the same configuration file and reversing direction, but may become confusing if you do not take care.
  • mail: if true, the script searches the mail_profiles_dir and tries to extract the active thunderbird profile. If its directory exists, then it is added to the other backup locations with mail_dest. Profiles for other programs should be added.
  • mode: if daemon, then a double colon (::) is inserted between the hostname and the target path. This is interpreted as an rsync daemon module. Otherwise a single colon is inserted between the hostname and path, which is interpreted as an absolute path.
  • locations: a list of pairs of source and destination paths. Trailing slashes can change the meaning of paths, so you need to verify they are really what you intend.

Copy the example config

cp conf_backup_example.json conf_backup.json

Set up all options as you wish, and then just run:

python conf_backup.json

And there it goes! If anything goes wrong you could check the log file (specified in the config) for clues.

If you would like, you could add this command as a cron job to run at scheduled times. I skipped this option, because I prefer to have control over the moments this load comes on both computers.


Preferably all the backup and git traffic would go through ssh using keys. git can do this out of the box, but as I found out the rsync daemon can only work through the rsync protocol, and does not yet support ssh. It is possible, however, to create an ssh connection that would start its own daemon. This is explained in Configuring the server: rsync.

First create a key for everything else (git, ssh)

ssh-keygen -t rsa -b 2048 -f ~/.ssh/mybox-homeserver

Copy the public key to the server

ssh-copy-id -i ~/.ssh/mybox-homeserver This email address is being protected from spambots. You need JavaScript enabled to view it..1.5

You will be prompted for server_user's password.

Create a separate key for rsync:

ssh-keygen -t rsa -b 2048 -f ~/.ssh/mybox-homeserver-rsync

Copy this one too:

ssh-copy-id -i ~/.ssh/mybox-homeserver-rsync This email address is being protected from spambots. You need JavaScript enabled to view it..1.5

If you are using a daemon on the server, you need to ssh to it and edit the public key that was just copied:

ssh -i ~/.ssh/mybox-homeserver This email address is being protected from spambots. You need JavaScript enabled to view it..1.5
vim /home/server_user/.ssh/authorized_keys

Find the corresponding key and prepend it with:

command="/home/server_user/home_server/ remote_rsync start" ssh-rsa AAAAB....

It is important that the command comes before the key itself. This will cause each connection with this key to launch the rsync daemon.

To make it even easier, edit ~/.ssh/config and add an entry for the server:

Host raspi_server
    IdentityFile ~/.ssh/mybox-homeserver
    User birdman

This way you only have to ssh raspi_server and you're on. This hostname can also be used as a git remote, which would automatically use the specified identity file and username.


If you set up repos in /mnt/backup_drive/code on the server, you could push to them:

git clone

git push

if you set up your ssh keys and ~/.ssh/config as described above you can use the Host as a remote:

git remote add raspi git+ssh://raspi_server:/mnt/backup_drive/code/imaginary_repo

Then push to it like this:

git push raspi master

This will use the configured identity file and user for the connection.


Clients should be able to see your server if the minidlna daemon has been started on it and you have configured your media directories.