Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I use password protection with the tar command in Linux? I'm new to Linux so please explain to me with simple usage.

share|improve this question

migrated from stackoverflow.com Apr 19 '11 at 17:00

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Run the output through pgp

tar .... | pgp --symmetric output.tar.pgp

decrypt:

pgp -d output.tar.gz | tar tv

Consider using proper asymmetric keys (public/private keys) for real protection

share|improve this answer
    
@sehe - Thanks a lot. But unluckily, I don't understand what you had written. Can you tell me a bit more detail? Thanks !!! –  kevin Apr 19 '11 at 8:40
1  
@kevin: To my understanding, a "symmetric key" is a plain-old password-based system, like you're familiar with. An asymmetric key system has two "passwords" or keys, a public and a private one. You can share the public one freely, and people use this to identify you. The private key is the part that proves that you are you, so sharing it is a Bad Thing. Anyhow, the symmetric key is almost certainly what you want, since it's much simpler, although the asymmetric key is more secure, in theory. –  bukzor Apr 19 '12 at 15:44

As far as I know tar doesn't provide this service. You could use 7zip instead, which does offer encrypted archives.

What you can also do is use gpg in addition to tar:

tar cvJf myarchive.tar.xz myfiles
gpg -c myarchive.tar.xz.gpg

This will give you a password protected archive.

share|improve this answer
    
hi thanks a lot, can you elaborate a little bit about this command tar cvJf myarchive.tar.xz myfiles gpg -c myarchive.tar.xz.gpg Sorry I'm new to Linux. –  kevin Apr 19 '11 at 8:38
1  
You need to read a tutorial on the linux command line. This is basic stuff. –  Peltier Apr 19 '11 at 8:47
    
Thanks again !!! Can you point me some good tutorial ? –  kevin Apr 19 '11 at 8:59
    
Try this site: gd.tuwien.ac.at/linuxcommand.org –  Peltier Apr 19 '11 at 9:11
1  
Thanks a lot !!! :D –  kevin Apr 19 '11 at 9:21

Your Answer

 
discard

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