How to run gpg from a script run by cron?

后端 未结 7 1305
予麋鹿
予麋鹿 2021-02-05 04:10

I have a script that has a part that looks like that:

for file in `ls *.tar.gz`; do
  echo encrypting $file
  gpg --passphrase-file /home/$USER/.gnupg/backup-pas         


        
7条回答
  •  情深已故
    2021-02-05 04:19

    In my case gpg cant find home dir for using keys:

    gpg: no default secret key: No secret key

    gpg: 0003608.cmd: sign+encrypt failed: No secret key

    So I added --homedir /root/.gnupg. The final command can looks like

    echo 'password' | gpg -vvv --homedir /root/.gnupg --batch --passphrase-fd 0 --output /usr/share/file.gpg --encrypt --sign /usr/share/file.tar.bz2

提交回复
热议问题