Piping tar into gpg

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Feb 20 23:40:53 CET 2013


On 02/20/2013 04:29 PM, Stefan Malte Schumacher wrote:
> I want to create encrypted backups with tar and gpg, which I then want to
> upload to my online storage. Strangely I can't get it working.
> "find /mnt/raid/Dokumente/ -type f -print0 |tar cfzv | gpg --symmetric
> --output 1.tar.gz.gpg"

if you want to pipeline like this, i don't think you want the "f" flag
for tar.

I also don't think you're using find and tar together properly -- i
think you want xargs in the mix.

here's a functional example, along with a verification step (i'm using
gpg-agent to prompt for the symmetric passphrases):

0 dkg at alice:/tmp/cdtemp.cD3zXc$ mkdir t
0 dkg at alice:/tmp/cdtemp.cD3zXc$ echo test > t/a
0 dkg at alice:/tmp/cdtemp.cD3zXc$ echo whatever > t/b
0 dkg at alice:/tmp/cdtemp.cD3zXc$ find t -type f -print0 | xargs -0 tar
czv | gpg --symmetric > foo.tgz.gpg
t/b
t/a
0 dkg at alice:/tmp/cdtemp.cD3zXc$ gpg --decrypt < foo.tgz.gpg | tar tz
gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
gpg: WARNING: message was not integrity protected
t/b
t/a
0 dkg at alice:/tmp/cdtemp.cD3zXc$


	--dkg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1027 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20130220/866e280b/attachment.pgp>


More information about the Gnupg-users mailing list