Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
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 '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
add comment

1 Answer

up vote 5 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

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.