Take the 2-minute tour ×

I have the following script:

#!/bin/sh -e
echo before
echo $PWD | gpg --passphrase-fd 0 -c $file
echo after

The scripts works perfectly fine if executed manually, but simply stops working when the gpg line is performed when performed as crontab.

GPG shows:


I'm grateful for any suggestions!

Solution: add --no-tty to GPG

share|improve this question
$PWD is very bad choice for a variable. it is a shell variable... –  dfc Oct 18 '11 at 22:00
add comment

2 Answers

up vote 1 down vote accepted

Add -vv to the gpg command to see more output. It might have to do with a missing ~/.gnupg though.

share|improve this answer
Thank you, that pointed me into the right direction: --no-tty –  MrG Oct 14 '10 at 10:37
add comment

/usr/bin/gpg --no-tty --passphrase-file /home/vouuuuuuuuu/settings/passfile.txt --decrypt-files /home/juhuuu/dirname/*.gpg;

works fine now thank to --no-tty before in cron job log gpg: cannot open `/dev/tty': No such device or address so it could not execute before, now is fine!

share|improve this answer
add comment

Your Answer


