Our UniFI Controller Update Process and Recent Releases: 5.10.15 / 5.10.16 / 5.10.17


@LTS_Tom & community

I’d like to script backing up the unifi autobackup.unf files found in


from my controller PC (Ubuntu 16.04.5 LTS) to my desktop PC (Kubuntu 18.04) that are both on the same network and run the script in CRON.

There are a couple of issues:

  1. /var/lib/unifi/backup/autoback is owned by root
  2. I use id_rsa for ssh with password. I’d like to have the script run daily in CRON so I need to automate login, but don’t know how to or best practice to accomplish this.

Here’s what I can do at this point:

  • script on controller running daily in CRON copies the most recent backup to a directory in $HOME && chown to me
  • manually rsync controller $HOME/dir with desktop $HOME/dir (manually enter id_rsa passwd)

The ultimate goal would be direct sync with CRON running on Desktop, but if I can accomplish #2 above and run a CRON on both systems, that would be OK.

I appreciate any suggestions; I have no experience automating logins. I definitely do not want to hard code in a password.


First, setup SSH keys so you don’t need to use interactive passwords, second you can use rsync to script the backup like this in a cron job:

rsync -avrhiO --no-perms --delete --progress --stats /var/lib/unifi/backup/autobackup/ -e ssh backupfiles@SomServer:/unifi/Backup/Loaction/

Thanks for the help Tom! Here is what I ran (as -n [–dry-run]) and the result

rsync -n -avrhiO --no-perms --delete --progress --stats -e ssh 
me@192.168.x.y:/var/lib/unifi/backup/autobackup/ $HOME/Desktop/unf_test

receiving incremental file list
rsync: change_dir "/var/lib/unifi/backup/autobackup" failed: Permission denied (13)

no pass on id_rsa gets me into controller, but I get a permissions error while trying to tinker with:


Btw, I’m trying to pull from controller (rsync source) to Desktop (rsync target), hence the change to rsync line.

Not sure how to get around the permissions error except to first run a sudo CRON on controller that copies .unf to my $HOME on controller with chown to me. Currently doing that. Root owns those files in /var

Is there another/ better way?

It works perfectly when use source as $HOME/autobackups/ that had previously been copied from /var and permissions set.

You appear to have “-e ssh” in the wrong place. Make it like mine

Also, you can use this https://crontab-generator.org/ to help with editing the crontab -e

Thanks Tom. Magic sauce is:

  1. create new id_rsa sans passwd on controller as ROOT.
  2. ssh-copy-id root id_rsap.pub to target PC
  3. edit crontab as root and use your command format or script

I chose to put the command in a script and call script in cron.

I just spent hours to save minutes! But I LEARNED new things.

Thank you.