This is how I run Borg on TrueNAS Core.
Create a jail
- Add a Borg group and user account to TrueNAS Core:
- Disable password: Yes
- Shell: nologin
- Create a dataset to store the Borg repositories:
- Create a new jail named
- Give it a static IP address so that other hosts on the network know where to connect for backups
/backupswithin the jail
- Start the jail
- Open a console to the jail (
iocage console borgor via the TrueNAS UI) and carry out the rest of these steps within the jail
Set up the jail
# Install prerequisites pkg update pkg install python38 py38-borgbackup # Enable the SSH server sysrc sshd_enable=YES # Add a Borg group pw group add borg -g <same GID as the Borg user you created in TrueNAS> # Add a Borg user pw user add borg -u <same UID as the Borg user you created in TrueNAS> -d /backups -g borg -s /bin/sh # Give the Borg user ownership of the backup repositories chown borg:borg /backups # For each backup client, add its SSH public key to the Borg user's authorized_keys echo <client SSH public key> >> /backups/.ssh/authorized_keys
Now you should be able to back up to this jail using Borg on each client, using a repo name such as
borg@borg:/backups/REPONAME. Don’t forget to add SSH public keys for any new clients.