Skip to main content

Password Protect Zip Files in Mac OS X


OS X Daily

7 hours ago by William Pearson

Zip Password in Mac OS X

Creating a password protected zip file is easy in Mac OS X and does not require any add-ons or downloads. Instead, use the zip utility that is bundled with all Macs.

If you're familiar with the command line, the syntax of the encrypted zip command is as follows:
zip -e [archive] [file]

If you're not sure how to use that, read on to learn how to create zip archives encrypted with passwords. These encrypted zip files will maintain password protection across platforms, meaning you can send a protected zip file to a Windows user and they will still need to enter the password in order to view the contents.

Set a Zip Password in Mac OS X

You can create password protected archives of files and folders:

  1. Launch the Terminal from the Applications > Utilities folder
  2. Type the following command:
  3. zip -e archivename.zip filetoprotect.txt

  4. Enter and verify the password – don't forget this

The resulting archive, in this case named "archivename.zip", is now encrypted with the password provided. The file that was encrypted, "filetoprotect.txt", is now inaccessible without entering that password.

Example: Zipping a Folder and Setting a Password
Here is an example of what this will look like from the command line, in this case we are compressing and password protecting the entire 'Confidential' folder located within the users /Documents directory, and the password protected zip is being placed on the users desktop for easy access:
$ zip -e ~/Desktop/encrypted.zip ~/Documents/Confidential/
Enter password:
Verify password:
adding: ~/Documents/Confidential/ (deflated 13%)

Notice the password will not display, this is normal behavior for the Terminal.

Opening the Password Protected Zip

Despite being created at the command line, you do not need to unzip the file from the terminal, it can be expanded from the Mac OS X Finder or within Windows using standard unzipping apps. Just double click on the file, enter the password, and it will decompress. You can also decompress the zip archive from the command line with:
unzip filename.zip

Here are some use cases for password protected zip archives:

  • Password protecting an individual file or directory
  • Sending a sensitive and encrypted file over an unencrypted network
  • Emailing confidential data to a Windows user
  • Adding an additional layer of security to a hidden folder
  • Password protecting your own backups, outside of Time Machine

While this can provide some protection on a per-file or folder basis, it's always a good idea to password protect the Mac in general with a login requirement on system boot, wake from sleep, and waking from the screen saver.

Comments

Popular posts from this blog

Rumor Mill: New mac Mini Coming?

There are reports all over the Internet about a new Mac Mini to be possibly released at MacWorld.  TUAW is reporting that a new version of the Mini will include an optical drive that can be swapped for a second hard drive.  The housing will look much like the Time Capsule with a "lip" for consealing the optical dive slot and cooling. Whether true or not, I would like to see a few features in a new Mac Mini. More RAM (Of course.) NVIDIA chipset. FW port for external HD My main use for a Mini would be for media.  A Mini on my network using Front Row would be great for movies and TV.  (Sorry, Apple TV.)

Calculate Age or Years Elapsed in an Apple Numbers Sheet

Often it is useful to show a person's age or years elapsed since a start date.  For example: Hire Date: 4/1/2012 - Years of service: 1.5 Here's a formula for Numbers that will do the trick: =IF(ISBLANK(cellReference),"",DATEDIF( cellReference ,TODAY(),"D")/365.2425) Replace the cellReference with the actual cell reference. i.e.: (A1)  So here's the breakdown: =IF(ISBLANK(cellReference),""  --- this checks to see if there is a start date in your referenced cell.  For example say your spreadsheet has a cell (A1) that holds a date of birth, but it is not yet referenced, this will result in an empty string. (Blank cell) Otherwise, it calculates the years:  DATEDIF( cellReference ,TODAY(),"D")/365.2425) DATEDIF compares two dates. The first date is your cell reference i.e.: (A1) The second is the current date according to your computer, iOS device: TODAY()  returning the Day -  "D" Then the difference is divi...

Acid3 Test

I did an Acid3 test with a few browsers and these are the results I got.  For those unfamiliar, as I understand it, Acid3 is a test to see how compliant a browser is with current standards with the W3C . Browser # 1: Chrome by Google.  Running under Windows Vista Home on my Mac in VMWare. 79/100 Not bad for a new browser.  I'll be curious to see what the Mac version will do when it comes out. Browser #2: Firefox v.3.0.1 Mac OS X 10.5.4 71/100 Not as good as Chrome, but I have a PILE of extensions on Firefox. Browser #3: Safari 3.1.2 Mac OS X 10.5.4 75/100 Better than Firefox but still lower than Chrome. My take is overall they seem to perform about the same but I'll stick with Safari for now.  I use Firefox for much of my web browsing, but Safari is fast becoming a close second. Someday, maybe I'll test Opera too. Cheers!