0% found this document useful (0 votes)
157 views

Creating Password Protected Zip Files Under Linux

This document provides instructions for creating encrypted ZIP files from files, folders, and multiple files in Linux using the zip command. It explains how to set a password non-interactively from a script by specifying the -P flag followed by the password. The document also shows how to unzip encrypted files without a prompt by also supplying the password on the command line with -P.

Uploaded by

Kartuun X.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
157 views

Creating Password Protected Zip Files Under Linux

This document provides instructions for creating encrypted ZIP files from files, folders, and multiple files in Linux using the zip command. It explains how to set a password non-interactively from a script by specifying the -P flag followed by the password. The document also shows how to unzip encrypted files without a prompt by also supplying the password on the command line with -P.

Uploaded by

Kartuun X.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Password Protected ZIP File in Linux

Create an encrypted ZIP file secure.zip from some file :


$ zip --encrypt secure.zip file
Enter password:
Verify password:
adding: file (deflated 8%)
Create password protected ZIP archive secure.zip from the several files :
$ zip --encrypt secure.zip file1 file2 file3
Enter password:
Verify password:
adding: file1 (stored 15%)
adding: file2 (deflated 30%)
adding: file3 (deflated 45%)
Create an encrypted ZIP archive secure.zip from a folder /var/log/ :
$ zip --encrypt -r secure.zip /var/log/
Enter password:
Verify password:
adding: var/log/ (stored 0%)
adding: var/log/dmesg.0 (deflated 74%)
adding: var/log/dpkg.log.9.gz (deflated 0%)
adding: var/log/samba/log.asc-nb (deflated 96%)
***
Use the following command to uncompress a ZIP file :
$ unzip secure.zip
Enter password:
***
Encrypt and Decrypt ZIP Archive in Linux
You were interactively prompted for the password in the examples above.
If you want to create a password protected ZIP file from some shell script, you
may want to do it non-interactively.
This method is more insecure, as the password is entered as plain text.
You can easily encrypt and decrypt ZIP files from the Linux command line without
being prompted for the password.
Do it as follows :
$ zip -P passw0rd secure.zip file
$ zip -P passw0rd secure.zip file1 file2 file3
$ zip -P passw0rd -r secure.zip /var/log/
Uncompress a password protected ZIP archive :
$ unzip -P passw0rd secure.zip

You might also like