on-the-fly encryption of tar using gpg
this line encrypts the files in /path2/files using a password stored in pass.txt.
I used this to prevent the password to appear in bash history or processlist.
Make sure you run chmod 700 pass.txt
if you’re on a (hosted) multiuser system.
tar cz /path2/files/ | gpg --batch --passphrase-file pass.txt --symmetric --cipher-algo TWOFISH > /path/to/backup.tgz.gpg
decryption
gpg --batch --passphrase-file pass.txt --decrypt backup.tgz.gpg | tar xz -C /unpack/destination/
More details on the different cipher algorithms can be found here. Helpful ssh and ftp piping here.