LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Password Protected compressed files script (https://www.linuxquestions.org/questions/linux-newbie-8/password-protected-compressed-files-script-685849/)

jedilost1 11-24-2008 06:11 PM

Password Protected compressed files script
 
I have been researching the possibility of using the Zip -e command in Linux to encrypt and compress a file with success. I am trying to find out if there is a script or someone can help me create one that i can run to automate password protection and compression of an entire directory. Please someone help me, it would be greatly appreciated and would help me get out of a big protection problem at the workplace. Thanks.:jawa:

billymayday 11-24-2008 06:22 PM

Why do you need a script? You could simply use the -r switch.

jedilost1 11-24-2008 06:42 PM

as far as i know the limitation on the files is 2gb for ZIP encryption. Is there a way to bypass that limit?
I'm really looking for a way to tar, zip or rar a directory with password protection. I've tried to no avail with the ZIP utility as one employees backups are around 3gb and everyone else's being around 900mb and two others 1.5gb.
I'm looking for a hint that can help me with this issue. I'm very familiar with many parts of linux shell scripting, but perl scripting and others like it i am not. If someone has a solution using one of these languages, i would be more than happy to learn.

lazlow 11-24-2008 06:49 PM

Not sure (by any means) but I think that limitation had to do with older MS disk formats having that limit and not ZIP itself.

ErV 11-24-2008 06:50 PM

Quote:

Originally Posted by jedilost1 (Post 3353323)
as far as i know the limitation on the files is 2gb for ZIP encryption. Is there a way to bypass that limit?

I'm not sure that such limit exists. In case it does exist, then
you could use another archiver. or you could encrypt archive with GnuPG.

jedilost1 11-24-2008 07:00 PM

Quote:

Originally Posted by ErV (Post 3353334)
I'm not sure that such limit exists. In case it does exist, then
you could use another archiver. or you could encrypt archive with GnuPG.

what other compression archiver supports encryption? I've been trying to look up gzip or tar and can't find any info on encrypting.

billymayday 11-24-2008 07:07 PM

the zip manual itself suggests using pgp to encrypt a zip archive. You can pipe any archiver through gpg (openpgp).

jedilost1 11-24-2008 07:12 PM

Quote:

Originally Posted by billymayday (Post 3353347)
the zip manual itself suggests using pgp to encrypt a zip archive. You can pipe any archiver through gpg (openpgp).

Unfortunately i am not familiar with gpg, i am going to research further. Here is a copy of my crudely made script. Thank you for your help.

#Script to compress and encrypt Backup Files and FTP it to Buffalo Device
#written by jedilost1
zip -e -r backup.zip /export/PrimeView/Staff/
#perl ftpput.pl -H 10.0.30.3 -u backup -p primev -d /disk1/backup /home/igor/backup/backup.zip
mv backup.zip /export/PrimeView/Staff/Miguel
rm -rf backup.zip

ErV 11-24-2008 07:24 PM

Quote:

Originally Posted by jedilost1 (Post 3353341)
what other compression archiver supports encryption? I've been trying to look up gzip or tar and can't find any info on encrypting.

rar and 7zip support encryptions. Both are available for linux. 7zip is opensource, rar is not.

Quote:

Originally Posted by jedilost1 (Post 3353350)
Unfortunately i am not familiar with gpg,

It is never too late to learn. Google for GnuPG tutorial or gpg tutorial. Also there is "The GNU Privacy Handbook"(also available as pdf somewhere) which explains how to use it.

billymayday 11-24-2008 07:28 PM

You could do something like
Code:

tar -cjf - /export/PrimeView/Staff | gpg -c --output backup.tar.bz2.gpg

jedilost1 11-24-2008 07:58 PM

Quote:

Originally Posted by billymayday (Post 3353358)
You could do something like
Code:

tar -cjf - /export/PrimeView/Staff | gpg -c --output backup.tar.bz2.gpg

thank you so much for the help..
Is there a windows utility that could help me decrypt and get this information back. Plus, what is the code to untar in linux?
It seems to be working though, you guys are the best.

billymayday 11-24-2008 08:23 PM

You could use
Code:

gpg -d tmp.tar.bz2.gpg | tar -xjf -
Not sure about the Windows side

billymayday 11-24-2008 08:26 PM

Looks like there's a windows gpg http://www.gnupg.org/download/index.en.html

Not sure about untaring though

jedilost1 11-25-2008 12:03 PM

Quote:

Originally Posted by billymayday (Post 3353391)
You could use
Code:

gpg -d tmp.tar.bz2.gpg | tar -xjf -
Not sure about the Windows side

thanks man the command worked
i would get an integrity error though when i used it

these are exact error msgs

bzip2: (stdin): trailing garbage after EOF ignored
gpg: WARNING: message was not integrity protected
tar: Child died with signal 13
tar: Error exit delayed from previous errors

jedilost1 11-25-2008 01:11 PM

Does anyone know how to integrity protect a gpg encrypted file?
I keep getting this message once i decrypt the archive file

Quote:

gpg: WARNING: message was not integrity protected
i'm sorry i've found out that this message comes out only when not using a public key for encryption, the -c makes it a conventional encryption and supposedly this is a normal message when using it.

Source


All times are GMT -5. The time now is 06:37 PM.