Howto backup OH4 to a Fritz!Nas using Amanda via CIFS

Hi All,
I have been struggling getting Amanda backup to my Fritz!Box working correctly for a few months now.
I see similar questions on these forums mostly unanswered, so I thought I would share my working setup.
Note, I am not asking for help here, just trying to share my working setup in the hope it will reduce someone’s pain.

Fritz!Box 7490 with os 7.57, with a USB drive configured as a NAS drive
RPI 4 Model B rev 1.4
OpenHab 4.1.1
Running on a 120gb SSD via USB

My RPi is in an inaccessible location, so I don’t want to connect another USB device for Amanda backups, so my goal was to backup to a remote device. I don’t have other Linux devices (e.g NAS) available.
The Fritz!Box does not support NFS (even though it is *nix), so CIFS is the only option.
Apparently there are ways of modifying the Fritz firmware to change this, but I did not want to compromise my fritzbox so this was not an option for me.

This is the setup that worked for me, YMMV:
On the Fritz!Box, create a new user (e.g. RPIBackup), this is done under “system”
Grant the user access to NAS contents
Plug your USB drive in to the FB (Hint use the USB 3 socket), mine is formatted with NTFS
Under Home Network / USB Storage:

  • You should see the drive, mine is called “SMI-USBDISK-01”
  • Tick Access via SMB and enable support for SMBv1

On the RPI via SSH:
sudo nano /home/openhabian/.smbcredentials
In that file add following 2 rows (should match the user you created in your Fritz!Boz):

username=RPIBackup
password=<RPIBackupPassword>

Ctrl+x to save and exit.

Then, add a new row to the fstab file:

sudo nano /etc/fstab
//192.168.123.1/FritzBox   /backup cifs    credentials=/home/openhabian/.smbcredentials,uid=backup,gid=backup,mfsymlinks,nounix    0       0

Ctrl+x to save and exit.
Note: use tab as a separator

All the above will mount your Fritz!NAS into a folder on the RPI called /backup
You need to create the backup folder (but not the subfolders):

openhabian@openhabian:/ $ ls -la
total 84
drwxr-xr-x  20 root    root     4096 Dec  7 13:42 .
drwxr-xr-x  20 root    root     4096 Dec  7 13:42 ..
drwxr-xr-x   2 backup  backup      0 Feb 19 15:21 backup

openhabian@openhabian:/backup $ ls -la
total 4
drwxr-xr-x  2 backup backup    0 Feb 19 15:21 .
drwxr-xr-x 20 root   root   4096 Dec  7 13:42 ..
drwxr-xr-x  2 backup backup    0 Feb 19 11:44 SMI-USBDISK-01

Once you have all this done reboot your RPi.
You should see the NAS drive mounted in the backup folder and the owner and group owner should be the backup user.

Validate this by creating and deleting a file from your RPi as the backup user

openhabian@openhabian:/backup $ su backup
Password:
[10:45:26] backup@openhabian:/backup$ ls SMI-USBDISK-01
[10:45:28] backup@openhabian:/backup$ cd SMI-USBDISK-01/
[10:45:34] backup@openhabian:/backup/SMI-USBDISK-01$ ls 
ohbackup  'System Volume Information'
[10:45:35] backup@openhabian:/backup/SMI-USBDISK-01$ touch file
[10:45:42] backup@openhabian:/backup/SMI-USBDISK-01$ ls
file   ohbackup  'System Volume Information'
[10:45:43] backup@openhabian:/backup/SMI-USBDISK-01$ rm file
[10:45:46] backup@openhabian:/backup/SMI-USBDISK-01$ ls
ohbackup  'System Volume Information'

Once I did all the above, I was able to successfully install Amanda backup from
sudo openhabian-config

Hope this helps someone!
Cheers
Will