Create a Password Protected ZIP

By  on  

Have you ever wanted to put very basic security (a passphrase) on a file?  You can do so if you ZIP the file -- let's have a look at how you can password-protect a ZIP file!

Creating a password protected ZIP file from command line is done so via the following command:

# zip -er {file name to be created} {source directory or file}
zip -er my-generated-file.zip source-file.rtf

When someone tries to unzip the file, they'll be prompted for a password.

Don't be under any illusion that a password makes the ZIP file too secure:  ZIP files don't self-destruct after a given number of attempts so a brute force effort to crack the password would ultimately be effective.  If you do, however, want a very basic level of security for the contents of a file, this command will get you there.

Recent Features

  • By
    5 Ways that CSS and JavaScript Interact That You May Not Know About

    CSS and JavaScript:  the lines seemingly get blurred by each browser release.  They have always done a very different job but in the end they are both front-end technologies so they need do need to work closely.  We have our .js files and our .css, but...

  • By
    CSS @supports

    Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn't been available within CSS.  What we end up doing is repeating the same properties multiple times with each browser prefix.  Yuck.  Another thing we...

Incredible Demos

  • By
    Firefox Marketplace Animated Buttons

    The Firefox Marketplace is an incredibly attractive, easy to use hub that promises to make finding and promoting awesome HTML5-powered web applications easy and convenient. While I don't work directly on the Marketplace, I am privy to the codebase (and so...

  • By
    JavaScript Canvas Image Conversion

    At last week's Mozilla WebDev Offsite, we all spent half of the last day hacking on our future Mozilla Marketplace app. One mobile app that recently got a lot of attention was Instagram, which sold to Facebook for the bat shit crazy price of one...

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!