Setup Borg Backup Server on Mac OS X

Setup Borg Backup Server on Mac OS X

See my other post on setting up the client side
See my other post on how to update casks in Homebrew.

Due to Borg Issue #913 brew cask install borgbackup is no longer updated with the latest version. However don’t fear I’ve written a guide on installing Borg Backup from Source on Mac OS X.

  • Create a new user borg using System Preferences
  • mkdir ~/.ssh;
  • Make a backup directory:
    eg.
    cd /Volumes/Backups/
    mkdir borg
    sudo chown borg borg
    sudo chmod 700 borg
    cd borg
    mkdir client.name
    sudo chmod 700 client.name

Add this to ~/.ssh/authorized_keys

It needs to all be on one line The documentation indents it and makes it look nice, but this is incorrect.

Where: client.name is a folder just for that client (You can host multiple repos on one Borg account safely) and ssh-rsa AAAAAAAAYOURKEYAAAAA== [email protected] is what you would normally put in authorized_keys. /Volumes/Backups/borg/ should be where you are keeping your backups.
/usr/local/bin/ is where Homebrew keeps your stuff.

  • chmod ugo+x (Set world executable, for some reason it wasn’t set)
  • Run borg as the borg user. If you get
    borg$ borg
    -bash: /usr/local/bin/borg: Permission denied

Then you forgot the above step.

  • chmod 700 ~/.ssh; chmod 600 ~/.ssh/authorized_keys
  • Test using ssh -l borg -i keyfile server.example
  • It should not say borg not found but should say PTY allocation request failed on channel 0

2 thoughts on “Setup Borg Backup Server on Mac OS X

  1. How to prepare the sink for this setup? I mean the server where I will store my backed up data. Even though the backed up data will be encrypted on my home laptop before reaching the server, is there any recommendation that how to set the sink/server up?

    1. You can set it up with just (assume you used the paths in the above example)
      mkdir /Volumes/Backups/borg/client.name
      chmod 700 /Volumes/Backups/borg/client.name

      On the **client**
      borg init --encryption=repokey borg-server:/Volumes/Backups/borg/client.name

      Which will make a directory called borg-repo that is now a repository for borg.

      I plan to write a guide on how to setup the client side soon.

      borg init only needs to be done once and you can move that folder around too!

      https://borgbackup.readthedocs.io/en/stable/usage.html#borg-init

      Hope this helps!

      P.S. borg-repo in this example is what you’d use in ssh to connect to your mac.

Leave a Reply

Your email address will not be published. Required fields are marked *