1748286 Members
3435 Online
108761 Solutions
New Discussion юеВ

PGP Shell Script

 
SOLVED
Go to solution
Michael Treacy
Advisor

PGP Shell Script

I need to script some batch commands for use with PGP 6.5.8 on our HP/UX. I do not want to save the passphrase anywhere it might be compromised, so I need to have the client be prompted for it. The commands work fine interactively, however I cannot get the prompt to display on the screen when it is run in batch...

How can I redirect stdin to the screen ?

CRYPT
{
$PGPPATH/pgp -esa +batchmode $PGPPATH/tmp/filename herkey -u mykey >>$PGPPATH/pgp_test.log 2>&1 <
}

Thanks in advance
6 REPLIES 6
Sandman!
Honored Contributor

Re: PGP Shell Script

Michael,

Are you scheduling it with either cron or at in batch mode...since processes kicked by either of them have no controlling terminal so the program won't prompt you for a passphrase.

cheers!
Michael Treacy
Advisor

Re: PGP Shell Script

It would not be scheduled through cron or at, but initiated by a user in front of terminal.
Jeff_Traigle
Honored Contributor
Solution

Re: PGP Shell Script

When you say it works interactively, you mean the following works?

$PGPPATH/pgp -esa +batchmode $PGPPATH/tmp/filename herkey -u mykey

The way you listed the execution in your script, you are redirecting stdout and stderr to the log file. If you want stdout to also appear on the screen (which should display the prompt), you can use the tee command:

$PGPPATH/pgp -esa +batchmode $PGPPATH/tmp/filename herkey -u mykey 2>&1 | tee -a $PGPPATH/pgp_test.log
--
Jeff Traigle
David Bellamy
Respected Contributor

Re: PGP Shell Script

Michael why don't you declare a variable for the passphrase before you issue the pgp command.
Michael Treacy
Advisor

Re: PGP Shell Script

tee is a beautiful thing...
THANKS !!!


Michael Treacy
Advisor

Re: PGP Shell Script

$PGPPATH/pgp -esa $PGPPATH/tmp/filename herkey -u mykey |tee -a $PGPPATH/tmp/pgp_test.log