Error: open /home/user/file: required key not available

I’m using restic run as root via https://github.com/erikw/restic-systemd-automatic-backup on Ubuntu 20.04. The home partition is ext4 encrypted and is decrypted upon user login.

Since restic is run as root via systemd, it throws this error:
Error: open /home/user/file: required key not available

Not being able to decrypted the files. Can it just back up the encrypted files ? Or is there a way for it to unlock the files, since root is really just sudo with the same password as user that decrypts the files ?

Thanks a lot!

If it’s an encrypted ext4 partition as you say then you could, in theory, back up the raw partition, but this would result in an unnecessarily large backup. The better approach would be to back up your home directory as your user and not as root. By design, root does not have access to the volume until it is opened by the user.