I am looking for an easy encryption program, usable from the linux command line. Preferably a single static binary. I tried scrypt (tarsnap), but it prompts for a password with no way to input as a flag. This means it cannot be used from a script.
Thank you for the help!

  • I'm not sure why you believe it cannot be used from a script. Check out this question and its detailed answer. It depends on the <<< operator. Also, a standard way to automate tasks which require user input is the Expect program, which likely already comes installed on your system and is easily acquired if not.
    – John Y
    Oct 1, 2018 at 19:48
  • Oh, I had meant to link to a Stack Overflow question for possible tips and further reading on expect, though the Wikipedia entry actually does have some nice examples already.
    – John Y
    Oct 1, 2018 at 20:17

1 Answer 1


You could use PGP/gpg:

# Encrypt
gpg --output file.gpg --encrypt --recipient [email protected] file

# Decrypt
gpg --output file --decrypt file.gpg

Before you can do that, you need to create a key pair and import it to your keyring. See the manual on how to do it: https://www.gnupg.org/gph/en/manual/book1.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.