Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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 -out 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 -out 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 '12 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. – Stuart Woodward Mar 8 '12 at 4:32
N.b. The zip command on Redhat is copyright Info-ZIP. – Stuart Woodward Mar 8 '12 at 4:47
up vote 5 down vote accepted

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

share|improve this answer

Your Answer


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

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