Skip to content

SFCOMPY™ :: Computer Repair Blog :: IT Blog

  • .HOME
  • .CATEGORIES
    • Ads
    • Audio
    • Booting
    • Data Recovery
    • Drivers
    • Data Recovery
    • File System
    • Hardware
    • Network
    • OS
    • Software
    • Security
    • System
    • User Account
    • Utility
    • Video
    • Web Browser
  • .MY ACCOUNT
  • .ABOUT
    • .Privacy Policy
    • .Terms
  • .SFCOMPY™
  • Toggle search form
sfcompy-spend-hours-ad
  • sfcompy namecheap ninja-black Friday deals
    NameCheap Black Friday: Web Ninjas unite! Ads
  • NameCheap Web Security QR SFCOMPY
    #ChooseNamecheap Web Security -Internet protection for you and your customers Ads
  • Namecheap! Transfer .COM and save 16% Ads
  • InMotion! Shared Hosting Landing Page Ads
  • sfcompy-inmotion-cyber-month
    InMotion Hosting – Cyber Week/Month Ads

Password Protected Zip file – MacOS CLI

Posted on July 16, 2021August 14, 2021 By SFCOMPY™ Editor No Comments on Password Protected Zip file – MacOS CLI
sfcompy-protected-zip-file

From what reason do I need to protect the ZIP file with a password ?

The motivation for creating a password protected Zip file comes when you wants to store on disk or to transfer over the internet (email, ftp, ssh, https…etc) a files or an archive with some level of protection beyond the protection that the storage software tool or the communication protocol provides. so creating the a password protected Zip file become a simple and perfect solution for you, means, you add your own password to protect the file or archive so then it can be unlocked only by you or by any other authorizes person that will receive the password from you.

What are the benefits of using a ZIP file ?

The benefits of using the ZIP tool to archive and compress files and folders is mentions at SFCOMPY™ post: Zip or UnZip files and folders 

But why we need to use the CLI in order to get password protected Zip file ?

The MacOS Finder GUI doesn’t have a native option to add password protection to the Zip file when you perform archive and compress to your file and folders

What are the best use-cases and scenarios to use a password protected ZIP file ?

  • its a simple and perfect use case to attach a password protected archive file to your email a that contains some sensitive information. This is a great solution when you wants that the only dedicate email receiver will have the option to extract the archive file but not any other person that also may share the same computer or email service. One of the simple way to do so, its by email the password protected Zip file and then to text the password to the receiver mobile phone
  • When you need to store some sensitive archive files in your USB flash drive while you are carry the flash drive during your traveling and in the scenario that you worry that you may loose or forget the flash drive somewhere. Adding the password to protect the archive Zip file its also a simple and a perfect use-case to protect your data that store in your flash drives
  • You want to upload from your computer to your cloud storage or to the web-server some sensitive archive files over the public network, this will gives an extra protection to your secure browser or file transfer protocol and anyone that will be able to capture the archive files will still need a password to extract the data

Any other things I need to know before I create a password protected ZIP file ?

Keep in mind!!! , To avoid the option that you will forever loose access to the protected ZIP file , means, to not be able to read your files\archive data from the protected ZIP file, from the reason that you do not have a long term way to store and to protect the integrity of the passwords or in case that you are not organize enough to remember where the password saved, (means you can’t guaranty that you will find the password when you need it to unlock the ZIP file) then its highly recommended to protect the ZIP file with a password only for immediate and short term needs, and then, after the password protected ZIP file serve it purpose, you have to decide if you wants to erase the ZIP file with the extracted sensitive file and folder from your computer or instead, to keep it and store the unlocked version of the archive ZIP file

How-To and Example:

  • To Archive and to Compress files and folders and adding a password protection to the ZIP file, we use the ‘zip’ command with the ‘-er’ switch as the following:
  • zip -er Archive_Name.zip File_Or_Folder_TO_Archive
  • when:
    ‘r’ : is for recurse into directories, means, it will archives the entire files and folders inside the folder you choose
    ‘e’ : is to encrypt the archive zip file
  • The command will be prompted with a password prompt, then you need to type twice the same password that will protect the ZIP archive file
# For example , given 'myfolder' folder which include two files  

bash > ls myfolder/
 pic1.png    report.txt

# To archive and compress myfolder with password protect

bash> zip -er my_protected_zipfolder.zip myfolder/
 Enter password: 
 Verify password: 
   adding: myfolder/ (stored 0%)
   adding: myfolder/pic1.png (deflated 3%)
   adding: myfolder/report.txt (deflated 58%)

bash> ls -ltr
 total 512
drwxr-xr-x  4 sfcompy  staff     128 Jul 13 16:58 myfolder
-rw-r--r--  1 sfcompy  staff  125956 Jul 16 14:16 my_protected_zipfolder.zip

# Now, if you try to extract the archive using the Unzip command, you will be prompt to type the password before the ZIP file is extracted

bash> unzip my_protected_zipfolder.zip 
 Archive:  my_protected_zipfolder.zip
    creating: myfolder/
 [my_protected_zipfolder.zip] myfolder/pic1.png password: 
   inflating: myfolder/pic1.png       
   inflating: myfolder/report.txt
  • Same things will happen if you try to extract the ZIP archive file using the Finder GUI, after pressing double click on the ZIP file ‘my_protected-zipfolder.zip’ windows password box will be prompted as you can see at the image below and only after typing the correct password the ZIP archive will be extract
  • DONE!

Related posts:

  • Sign a pdf file Using Microsoft EdgeSign a pdf file Using Microsoft Edge
  • sfcompy_blog_412x331Find the Running Process of a Given User - MacOS CLI
  • sfcompu_macosx_login_412x331Hide or Show mac Login User - MacOS CLI
File System, Network, Security, Utility Tags:All Macs, Command Line (CLI), iMac, Mac Mini, MacBook

Post navigation

Previous Post: Zip or UnZip files and folders – MacOS CLI
Next Post: SFCOMPY™ Visual Studio Code Color Theme For Pro

Leave a Reply Cancel reply

You must be logged in to post a comment.

InMotion Hosting - Cyber Week/Month Dedicated Hosting Landing Page

Recent Posts

  • sfcompy-protected-zip-filePassword Protected Zip file – MacOS CLI
    July 16, 2021
  • sfcompy-zip-archive-and-comoressZip or UnZip files and folders – MacOS CLI
    July 13, 2021
  • sfcompy_blog_412x331Show Hidden files – MacOS CLI
    June 23, 2021

InMotion Shared Hosting Landing Page Sale

InMotion WordPress Hosting Landing Page Sale

InMotion Reseller Hosting Landing Page

Categories

  • Ads (5)
  • Data Recovery (1)
  • File System (3)
  • Network (4)
  • OS (3)
  • Security (9)
  • Software (1)
  • System (3)
  • User Account (5)
  • Utility (4)
  • Video (1)
  • Web Browser (1)

Tag

All Ads (4) All Android (2) All IOS (2) All Linux (2) All Macs (12) All Windows (4) Command Line (CLI) (8) iMac (8) InMotion (2) mac (1) MacBook (8) Mac Mini (8) namecheap (2) Pro and Advance User (7) Standard or local User (1)
July 2025
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  
« Mar    
  • Sign a pdf file Using Microsoft Edge
  • InMotion Hosting – Cyber Week/Month
  • NameCheap Black Friday: Web Ninjas unite!
  • #ChooseNamecheap Web Security -Internet protection for you and your customers
  • InMotion! Shared Hosting Landing Page

  • Sign a pdf file Using Microsoft Edge
  • InMotion Hosting – Cyber Week/Month
  • NameCheap Black Friday: Web Ninjas unite!
  • #ChooseNamecheap Web Security -Internet protection for you and your customers
  • InMotion! Shared Hosting Landing Page
  • Sign a pdf file Using Microsoft Edge
  • sfcompy-inmotion-cyber-monthInMotion Hosting – Cyber Week/Month
  • sfcompy namecheap ninja-black Friday dealsNameCheap Black Friday: Web Ninjas unite!
  • NameCheap Web Security QR SFCOMPY#ChooseNamecheap Web Security -Internet protection for you and your customers
  • InMotion! Shared Hosting Landing Page
  • sfcompy_blog_412x331
    Find the Running Process of a Given User – MacOS CLI OS
  • sfcompy_macosx_suso_user
    Create a Sudo User – MacOS CLI Security
  • sfcompy-vsc-color-theme-screens
    SFCOMPY™ Visual Studio Code Color Theme For Pro System
  • sfcompy_blog_412x331
    Hide or Show the mac Users folder – MacOS CLI Security
  • sfcompy namecheap ninja-black Friday deals
    NameCheap Black Friday: Web Ninjas unite! Ads
  • Namecheap! Transfer .COM and save 16% Ads
  • sfcompy-inmotion-cyber-month
    InMotion Hosting – Cyber Week/Month Ads
  • NameCheap Web Security QR SFCOMPY
    #ChooseNamecheap Web Security -Internet protection for you and your customers Ads
  • About
  • Cart
  • Category
  • Checkout
  • Computer Repair & IT Service Blog
  • My account
  • Post Page
  • Privacy Policy
  • Shop
  • Terms

Copyright © 2025 SFCOMPY™ Computer Repair & IT Blog .

Powered by SFCOMPY™ WP Theme for Pro WordPress theme