1

I am developing a script that will sign and encrypt a file.

I have 2 problems:

  1. While running the script it sometimes ask for a passphrase then after entering it manually in the next run it will not ask me again. Then after some time it will ask me again for passphrase. Is it just a session after I enter the passphrase manually that after some time the session will end and I need to enter it again? If so how can I automate this?

Command Used:

gpg --always-trust --compress-algo 1 --cipher-algo cast5 --armor \
    --recipient test@google.com --local-user localuser@google.com --passphrase "asdf2lkjh" \
    --output done_output.txt.gpg -se o113142.out
  1. Before I can sign + encrypt a file I need to execute screen command. I am using screen -m -d bash -c scriptname.sh, but upon checking the list of screen, every time I'm running the command another detached screen is added. How can I run the script that automatically executes the screen and exit the screen after the script is done running.

I'm planning to run this via crontab and it needs to run without any manual entering of passphrase or killing the screen.

  • See unix.stackexchange.com/questions/330305/…. The first part of your question can be solved with: gpg --batch --yes --passphrase ${ENC_KEY} -ac ${file}. Just add all other options to sign. As of the second part - here I won't help you as have never used screen utility. – ddnomad Jul 3 '17 at 8:15
  • Hi ddnomad! thank you so much for your help! it is now working for me now, its not prompting me to enter the passphrase manually! thanks!! – John Andrew Aguila Jul 4 '17 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.