TrueNAS Backup while preserving file permissions and ownership

In this small blog post I want to show how you can setup a backup task (Rsync Task) in TrueNAS while preserving the file permissions and ownership on the destination system.

One big problem I had with my external backup was that after a restore all my file had wrong file permissions and the ownership of the files where wrong too 😡

For the backup task to function we need to enable ssh on your destination system.

  1. First you need to access the TrueNAS console. You can access it via the Web UI:

    truenas-shell

  2. Now create a private and public RSA key for the ssh communication between the TrueNAS and the destination machine. So the ssh communication can be established without needing passwords. Put the following commands into the TrueNAS shell:

    sudo -i
    ssh-keygen

    All prompts from the ssh-keygen-command can be confirmed with the ENTER-key.

  3. Now you need to enable ssh access for the root-User on the destination system (192.168.0.34).

    sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
    sudo systemctl restart ssh
    sudo mkdir /BACKUPS
  4. Now access the TrueNAS shell again and the copy the public RSA key to the destination system (192.168.0.34)

    sudo -i
    ssh-copy-id root@192.168.0.34
  5. Setup Rsync Task via TrueNAS Web UI (click on the Add-Button in the Rsync Task-Box:

    truenas-rsync-task

  6. Now you can configure the Rsync Task like so and press Save at the end:

    truenas-rsync-task2

In an event of a Restore the Direction in the Rsync Task can be changed from Push to Pull

Previous Post Next Post

Add a comment