From the zip
man page:
-P password
--password password
Use password to encrypt zipfile entries (if any). THIS IS INSECURE! Many multi-user operating systems provide ways
for any user to see the current command line of any other user; even on stand-alone systems there is always the
threat of over-the-shoulder peeking. Storing the plaintext password as part of a command line in an automated script
is even worse. Whenever possible, use the non-echoing, interactive prompt to enter passwords. (And where security
is truly important, use strong encryption such as Pretty Good Privacy instead of the relatively weak standard encryp-
tion provided by zipfile utilities.)
The upshot is that if your zip process takes a while, another user on the system might be able to see the command entered, which would include the password. oops. Presumably this applies to the .7z
solution as well.
You really don't want to put your secret on the command line where it can be read from ps or your history file. – Samuel Edwin Ward – 2013-06-17T17:09:01.020
Encryption compresses files anyway. If rock solid encryption is more important than file size, you should consider using GPG. – Iain – 2010-01-13T23:10:49.000
4@Iain: that's true for GPG but not for all encryption tools. the way it works is, encrypting something makes it look like random data, which isn't compressible (or at least isn't compressible by much, if your encryption is any good). if you want to compress and encrypt, do your compression first, and encrypt the compressed data. some tools (like GPG) do this for you automatically, but understand that's a feature of the tool, not of the encryption. – quack quixote – 2010-01-13T23:34:10.547
@Iain: thank you; i didn't know GPG did compression for you automatically. found it in this article on GPG (see the "Encrypted Tarballs" section): http://www.linuxjournal.com/article/8732
– quack quixote – 2010-01-13T23:42:07.517IIRC the compression done by GPG is (or is similar to) gzip with default settings which is a good compromise of compression rates and speed. If the data you are sending is very large and the connections it will be sent over slow then you will get some benefit from using 7zip first, but it takes a fair multiple longer to compress the same data so you might find GPG's built in compression support more convinient. – David Spillett – 2010-01-16T21:40:15.410