GnuPG Shell Script - Refuses to read password

Posted by OopsForgotMyOtherUserName on Stack Overflow See other posts from Stack Overflow or by OopsForgotMyOtherUserName
Published on 2010-03-27T18:37:14Z Indexed on 2010/03/27 18:43 UTC
Read the original article Hit count: 337

Filed under:
|
|
|

The script below used to work on Mac OS X, but, since moving it to Ubuntu, it doesn't seem to read from the password file at all. Even when I run it from the command line, no matter what I do, I get a popup prompt asking me for the password. As this will run via cron, I don't want this to happen... I want it to read the password from the file with no prompt. To note, I did try using passphrase-fd and passphrase-file, neither of which worked...

#!/bin/sh
p=$(<pass.txt)
set -- $p
pass_phrase=$1
destination="/var/www/decrypted"
cd /var/sl_bin/
for FILE in *.pgp;
do
    FILENAME=${FILE%.pgp}
    gpg --passphrase "$pass_phrase" --output "$destination/$FILENAME" --decrypt "$FILE"
    rm -f $FILE
done

© Stack Overflow or respective owner

Related posts about gpg

Related posts about ubuntu