2

Can the encryption option on Info-ZIP be used from the command line? The zip man page says:

-e --encrypt Encrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt (this will not be echoed; if standard error is not a tty, zip will exit with an error). The password prompt is repeated to save the user from typing errors.

Is there a way to create zipped files from an unattended script?

3
  • 1
    If you really want any level of encryption worth mentioning (zip encryption is trivial to crack) you should use something like openssl bf -salt -k passphrase -in file.zip -out file.zip.bfe to encrypt the zip file (this can also be done on the fly by piping. Decryption is as easy as openssl bf -d -salt -k passphrase -in file.zip.bfe -out file.zip. Zip doesn't support unzipping from a pipe, so you can't decrypt a zip on the fly with openssl. You can use gzip and tar however, it depends on your needs.
    – Chris S
    Mar 8, 2012 at 3:02
  • @ChrisS I guess there is a free OpenSSL client for windows too. The zipped files will be sent to an FTP server to be picked up by a Windows user. The encryption is mainly just to avoid a casual user from accidentally peeking into the file. Mar 8, 2012 at 4:32
  • N.b. The zip command on Redhat is copyright Info-ZIP. Mar 8, 2012 at 4:47

1 Answer 1

6

Using -P will allow you to pass the password on the command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.