Login/Register

How to: Create Password Protected ZIPs in Ubuntu 16.04 using 7zip

created by BasicSysAdmin

Tags: Linux, Ubuntu, Ubuntu 16.04, Ubuntu 14.04

Jun 01, 2016

Introduction

In this guide, I will show you how to create Password Protected ZIPs in Ubuntu using the 7zip package.

Prerequisites


In order to follow this tutorial, you will need the following
  • Ubuntu Machine (See tags for supported distros)

  • Sudo privileges (or root access)



  • Update Package list

    Before installing any new packages, it is always good idea to update your package list. You can do this by typing:
    sudo apt-get update

    Installing 7zip

    sudo apt-get install p7zip-full

    After you have done this, 7zip should be installed.
    Using 7zip

    To use this to create a password protected zip file, you can use the following command - Make sure to replace the password with your own (you can use special characters) and the correct directory.
    7za a -tzip -p'PASSWORD HERE' -mem=AES256 "/place/to/store/backups/backup.zip" /directory/* -R

    You can also include the date in the file name like this
    7za a -tzip -p'PASSWORD HERE' -mem=AES256 "/place/to/store/backups/$(date +%d-%m-%Y).zip" /directory/* -R