Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How user gpg for encrypt a directory?

example; gpg /home/user/labs-scripts <<< all files in directory or only directory?

thanks for your collaboration.

share|improve this question
up vote 0 down vote accepted

Given that gpg will only encrypt a single file (or equivalent) the natural solution is to create a gpg encrypted tarball.

First let me show the two step approach.

$ tar -C /home/user -cf scripts.tar labs-scripts/
$ gpg -r 0xabcdef -e scripts.tar

You can also do it in one sweep, by piping the tar steam.

$ tar -C /home/user -cf - labs-scripts/ | gpg -r 0xabcdef -o scripts.tar.gpg -e
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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