I'm trying to encrypt symmetrically (with gpg) a file from a cron job. The line in my script doing this is :
c/usr/bin/gpg --no-tty -vv --exit-on-status-write-error --batch --passphrase-file /home/backup/full/pass --cipher-algo AES256 --symmetric fullbackup.tar.bz2 > error.log 2>&1
It's working well when I execute the script from prompt, but not from crontab.
I tried with or without the options --no-tty
,--batch
,--quiet
,--passphrase-fd 0
with an cat passfile
, --passphrase-file /gpg/mypass
and others tricks found on other topics (here). Nothing works. The script is ran from crontab as root.
Adding a logfile with 2>&1 >error.log
doesn't help as the file (70 bytes) is populated with random binary characters.
I'm on debian with gpg 1.4.12.
What else can I try?
Here is the script :
#!/bin/bash
#creating the tar
tar -cpjf /home/backup/full/fullbackup.tar.bz2 --directory=/to_backup
#enc it
/usr/bin/gpg --no-tty -vv --exit-on-status-write-error --batch --passphrase-file /home/backup/full/pass --cipher-algo AES256 --symmetric fullbackup.tar.bz2 > error.log 2>&1
#[...] ftp upload