How can I give a password to a zip file on Mac OS X without downloading any additional program?
I found the solution.
Go to Terminal and type
zip -er (zipfile's name).zip (File path)
Enter password: (your password)
Verify password: (type it again)
press enter. That's it. It will be saved to your main folder. You have a passworded zip file now.
-
2To zip a folder, use above format, to zip a file
zip -e [archive] [file]
eg: zip -e ~/Desktop/zippedFile.zip/ ~/Documents/FileToZip.doc – anas.p Nov 21 '18 at 5:02 -
4Note that the recommended flag -e encrypts the file with week encryption that can be broken with brute force. You should use -P instead. P flag uses AES256 encryption that has no known ways to be brute forced when used with sufficiently complex password. – djabi Feb 13 '19 at 17:27
-
@djabi Just out of curiosity, where does it really authoritatively say or show that
-e
uses weak encryption and-P
doesn't? I can't seem to find good info about the type of encryption that these options apply. Moreover, what would happen if both (-e -P
) were used? – Acumenus Nov 4 '19 at 19:24 -
4Not sure -P does what @djabi thinks it does. From the man file on macOS Mojave: "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..." Looks to me as though -P is just a way to specify the password on the command line. – Dave Ruske Dec 17 '19 at 19:11
-
1I agree the encryption is weak and "-P" does not change that. From the zip FAQ: Finally, note that the original encryption scheme used in all versions of Zip (as well as PKWARE's older products) is quite weak; see "A Known-Plaintext Attack on the PKZIP Stream Cipher" (also as gzip'd PostScript) by Eli Biham and Paul C. Kocher. Recent versions of PKZIP and WinZip include stronger AES encryption, and PGP/GnuPG have provided strong encryption for many years. – Tapper Jan 10 '20 at 14:54
Add password for an existing zip file:
zipcloak file.zip
Limitations listed in man zipcloak
for v3.0:
- zipcloak uses original zip encryption which is considered weak.
- Large files (> 2 GB) and large archives not yet supported.