Useful tips for making an encrypted zip file on Linux based system

Imagine this situation: you are in the middle of some very detailed and informative job and you are in urgent need of zip archive. Isn’t it better to establish some password protection for it? You think this is impossible? Well, this time you might proudly say that Linux is indeed the best and the most convenient system, because it also provides you numerous ways to have an encrypted zip file with a password for better security. Check out our tips and guides, and find out how to have an encrypted zip file on your Linux-based device now.

Using standard zip that comes with most systems

In some Linux distros zip is not installed by default. So before to continue with next steps make sure it is installed.

howopensource@esprimo:~$ sudo apt-get install zip unzip

The encryption feature is possible to be made via the zip command line tool. The general algorithm that is applied might be found here – http://www.academia.edu/348210/PKZIP_Algorithm. It`s name is PKZIP algorithm, but it is known as insecure. This lack of safety is even more emphasized with the fact that you are supposed to write the password in a file with plain text that is also shown.

howopensource@esprimo:~$ zip --password MY_SECURE_PASSWORD encrypted.zip test.txt

Second way which is much more secure because dosn’t show the password in plain text is to use option -e

howopensource@esprimo:~$ zip -e encrypted.zip test.txt
Enter password:
Verify password:
  adding: test.txt (deflated 8%)

Encrypted file is unzipped as normal file, except that you will be asked for a password.

howopensource@esprimo:~$ unzip encrypted.zip
Archive:  encrypted.zip
[encrypted.zip] test.txt password:
  inflating: test.txt

Use 7zip

Meet 7z file archiver and find out how the security level of your encrypted zip file can be as high as you want to. The application – with official description here http://www.7-zip.org/7z.html uses the AES-256 algorithm along with another algoritm – the hash SHA-256. So using 7z is more secure.

To compress the file with the 7z archiver use the following command:

howopensource@esprimo:~$ 7za a -tzip -pMY_SECURE_PASSWORD -mem=AES256 encrypted.zip test.txt
7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)
Scanning
Creating archive encrypted.zip
Compressing  test.txt
Everything is Ok

Second way is just to specify parameter -p without password – then you will be asked to enter it. Second way is considered more secure because does not show password on screen, neither in command line.

howopensource@esprimo:~$ 7za a -tzip -p -mem=AES256 encrypted.zip test.txt
7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)
Scanning
Creating archive encrypted.zip
Enter password (will not be echoed) :
Verify password (will not be echoed) :
Compressing  test.txt
Everything is Ok

And to uncompress such a file, follow this command:

howopensource@esprimo:~$ 7za e encrypted.zip
7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)
Processing archive: encrypted.zip
Extracting  test.txt
Enter password (will not be echoed) :
Everything is Ok
Size:       66
Compressed: 229

Use GnuPG’s symmetric key encryption

There is one more approach into making a safe encrypted zip file on your Linux system and it is based on the GnuPG`s symmetric key encrypting method.

Make a compressed tar archive with encryption like that:

howopensource@esprimo:~$ tar czvpf - test.txt | gpg --symmetric --cipher-algo aes256 -o encrypted.tar.gz.gpg

Extract encrypted files with next command:

howopensource@esprimo:~$ gpg -d encrypted.tar.gz.gpg | tar xzvf -

Use GUI

If you are using Ubuntu or any other distro that comes with Nautilus file manager. So in case you are a Nautilus user, use its GUI to have a zip file with safety measure password. Begin with highlighting the current files you want to archive in zip and then click with them with the right mouse button. Select compression option from menu.

Nautilus Encrypt Zip File

Then insert the name you want your archive to be called and add the .zip ending – .7z if you have 7z archiver installed on your Linux station, too. Go to other options and insert the password you want. Bellow, you can see the Nautilus command in details.

Ubuntu Nautilus File Manager Password Protect File

Hope this article helps you to protect your data and privacy.

Related Posts Plugin for WordPress, Blogger...