I’m working on writing a bash script that runs in the background and executing my backup automatically using crontab.
I have everything working as it should using “pass” to place the repository passwords that are needed for kopia to connect and make the snapshots. the problem is when I try to backup i.e. /etc I have to be sudo/root and that does not work.
the reason it does not work I Have concluded is that to make a root-owned “pass - .password-store” file (where the passwords are stored in rest by “pass”) I have to have a gpg key that is linked to an email made for/by root/sudo.
I can not figure out how to do this.
I have tried these commands:
sudo gpg2 --gen-key
sudo gpg -(k)K --full-generate-key
sudo su --> gpg2 --gen-key
sudo su --> gpg -(k)K --full-generate-key
after having put in all the information required to generate said key, I just get an error message:
gpg: agent_genkey failed: Permission denied
Key generation failed: Permission denied
Can anyone help?
or how do you run automated background backups of directories that need sudo permissions?