How do I create an encrypted (password protected) zip file?


This will prompt for a password:

zip --encrypt file.zip files

This is more insecure, as the password is entered/shown as plain text:

zip --password (password) file.zip files

Warning, the standard zip encryption is very weak and is easily cracked.

  • 2
    Is there a better option from the standard encryption? – David Oneill Dec 15 '10 at 20:47
  • 5
    Using gnupg on the final zip with a key for yourself or your destination. – Pete Ashdown Dec 15 '10 at 21:43
  • 1
    Does not work file.zip is empty – Black Aug 29 '17 at 12:15
  • 5
    @Black If you're trying to compress a folder, then you need to use -r switch. So it'll be zip --encrypt file.zip -r your_folder – H G Sur Jan 20 '18 at 11:55

You can also right-click on a folder or file(s) in Nautilus and select "Compress...". In the resulting window, you can expand the "Other Options" section to enter a password.

alt text

If the password field or any of the other options are not enabled, then the selected compression option does not support it. Select a different one from the list after the filename. According to the documentation:

Currently, only 7-Zip, ZIP, RAR and ARJ archives support encryption

  • 4
    It's worth noting that you need to install .rar before you can use it in the compressor. – Xeoncross Feb 20 '12 at 0:59
  • 9
    I don't see "Other Options" anymore in Ubuntu 17.10 (I remember seeing it in earlier version though) – Jonathan Dec 12 '17 at 22:04

Starting from Ubuntu 17.10, right-clicking and selecting "Compress" no longer has "Other Options" listed.

To resolve this, open "Archive Manager" and then drag & drop the files/folders from your File Manager into it and it will appear.

sudo apt-get install zip
zip -r --encrypt result.zip folder
  1. Install zip
  2. Use -r to zip directory and subdirectory
  3. Use --encrypt to secure your files

    with a simple password-based symmetric encryption system, which is documented in the ZIP specification


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.