"Unable to open cache" when doing a backup

Hello, on running restic -r … backup … I get the message unable to open cache: OpenFile: open /home/me/.cache/restic/CACHEDIR.TAG: permission denied, then the backup proceeds normally and a check after it’s finished finds no error. I wanted to make sure that it’s ok, though. The owner of the ~/.cache/restic/CACHEDIR.TAG is root, should I change it?

I’m running Ubuntu 18.04 and restic 0.8.3 (from Ubuntu’s repo). I was running restic 0.9.1 on Debian Buster a couple of weeks ago and I didn’t have this issue.

Just curious, did anything change about how you ran restic between a couple weeks ago and today?

Nope. I ran the same commands.

The owner of all the files in the ~/.cache/restic directory should be the user who is running the restic binary. If it’s root then that’s fine. If you’re running restic as a user and the files (including CACHEDIR.TAG) is owned by root, that does not sound right.

The error is printed because restic tries to re-create the CACHEDIR.TAG file on each run, that’s even cheaper than checking if the file is there and only create it if it does not exist yet. I’ve just changed that though, so in future releases of restic it’ll just leave the file alone if it’s already there:
https://github.com/restic/restic/commit/bd742ddb692ffeaf5ac24eefdff0c0ba3e7c17fb

The owner of all the files in the ~/.cache/restic directory should be the user who is running the restic binary. If it’s root then that’s fine. If you’re running restic as a user and the files (including CACHEDIR.TAG) is owned by root, that does not sound right.

I run restic as a normal user. Should I chown ~/.cache/restic?

1 Like

Yes. restic needs to have read and write access to all files in the cache directory.

1 Like