LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   password protect zip files (https://www.linuxquestions.org/questions/linux-newbie-8/password-protect-zip-files-177576/)

xlord 05-03-2004 10:34 PM

password protect zip files
 
I dont have the option -P enabled on my host, but i was wondernig if there was another way of password protecting zip files? like some kind of htaccess or something

os* rh, slack ( just incase )

shedir 05-04-2004 03:43 AM

You could use openssl to encrypt the zip file.

xlord 05-04-2004 10:16 AM

hmm i never even tried that.. can you tell me how to do this.. or maybe a site on where i can read about this

shedir 05-04-2004 12:04 PM

At first you should install openssl - the easiest would be to use the package that ships with your distribution. (Sources can be found on www.openssl.org)

To encrypt a file:
openssl enc -e -cipher -in clear file -out encrypted file
(The -e option is standard and therefor optional)

This will prompt for a password an encrypt the given file.
Without the "-in" and "-out" option openssl will read from stdin and write to stdout.

To decrypt a file:
openssl enc -d -cipher -in encrypted file -out clear file

The cipher (and mode) to be used must be specified. http://en.wikipedia.org/wiki/Block_c...s_of_operation gives a good introduction to block ciphers and the modes of operation. The blowfish cipher in cbc mode is a good choice ( "-cipher" = "-bf-cbc" or just "-bf" as cbc is the default).

The enc command of openssl has it's own man page ("man enc" or http://www.openssl.org/docs/apps/enc.html).
BTW: If security matters you should not specify the password on the commandline as it will be saved to you shell history and displayed by programs like ps.

Hope that helps


All times are GMT -5. The time now is 09:27 PM.