Linux Archive password managment!

Go down

Linux Archive password managment! Empty Linux Archive password managment!

Post by jamied_uk on 10th August 2014, 09:21

Quick way to encrypt file(s)
zip --encrypt secret.txt
it will ask for password!

the text file is the original unencrypted file and
the file is the output file


Another way of encrypting files with linux

In this tutorial, I will describe how to create an encrypted zip file on Linux.

Method One

The zip command line tool provides an encryption option. The encryption algorithm used by zip command is PKZIP stream cipher. The PKZIP algorithm is known to be insecure. Also, the fact that the password is typed and shown in plain text makes it even more vulnerable.

To create an encrypted zip file with zip:

zip --password MY_SECRET doc.pdf doc2.pdf doc3.pdf

To uncompress a zip file that is encrypted with zip command:


[] doc.pdf password:

Method Two

7z file archiver can produce zip-format archives with more secure encryption scheme. According to the official description, 7z archiver supports AES-256 encryption algorithm with SHA-256 hash algorithm based key generation.

To create an encrypted zip file with 7z archiver:

7za a -tzip -pMY_SECRET -mem=AES256 doc.pdf doc2.pdf doc3.pdf

To uncompress a zip file that is encrypted with 7za command:

7za e

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)

Processing archive:

Extracting  doc.pdf
Enter password (will not be echoed) :

Method Three

Another way to create a secure zip archive is to use GnuPG's symmetric key encryption.

To create an encrypted compressed tar archive with GnuPG:

tar czvpf - doc.pdf doc2.pdf doc3.pdf | gpg --symmetric --cipher-algo aes256 -o secure.tar.gz.gpg

To uncompress an archive file encrypted with GnuPG:

gpg -d secure.tar.gz.gpg | tar xzvf -

Method Four

If you use Nautilus file manager on your Linux desktop, you can use Nautilus GUI to create a password-protected zip file easily.

First, highlight a set of files to include in the archive. Then right-click them, and choose "Compression" option.

Another way is mcrypt

$ mcrypt data.txt

Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase:
Enter passphrase:
A new file is created with the extension .nc i.e.
$ ls
 $ cat

Decrypt the file:

$ mcrypt -d

Enter passphrase:
File was decrypted.
Verify that file was decrypted:
$ ls data.txt
 $ cat data.txt
For mcrypt to be compatible with the Solaris des, the following parameters are needed:

$ mcrypt  -a des --keymode pkdes --bare -noiv  data.txt

Delete the input file if the whole process of encryption/decryption succeeds (pass -u option):

$ mcrypt -u data.txt


$ mcrypt -u -d
openssl command
OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them. You can use the openssl program which is a command line tool for using the various cryptography functions of OpenSSL's crypto library from the shell. It can be used for encrypt and decrypt files with a password:
Encrypt file.txt to file.out using 256-bit AES in CBC mode

$ openssl enc -aes-256-cbc -salt -in file.txt -out file.out

Decrypt encrypted file file.out

$ openssl enc -d -aes-256-cbc -in file.out

Posts : 2471
Join date : 2010-05-09
Age : 36
Location : UK

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum