How to encrypt files on linux?
There are various commands for encrypting files on Linux. You can use file permission option to limit the access of file contents but the more effective limiting of access on files can be done by choosing the file encryption option. The encryption of files in Linux means that a file is altered with commands and tools of Linux and it is unusable and unreadable for everyone unless the owner did not reverse the process of encryption. The size of the file is not reduced while encryption in Linux unless compression is not used for it. The encryption might make some files larger.
While preparing the file to encrypt there are some things which you need to keep in mind and those are how you intend to use it, how to manage keys of file decryption, and check whether the original file remains in the original system or replace from the place after encryption. Every user’s top priority is security and the user wants to secure sensitive information.
WAYS OF ENCRYPTING FILES ON LINUX
- gpg
The gpg is one of the most standards and well know tools for encrypting files. Both digital encryption and signing services are provided by gpg. The compression of files is not a feature of gpg before encrypting the file contents. The gpg command will work with one file at one time. The command like $ gpg – c BigFile will encrypt the contents of the file by using the symmetric key.
- Zip
The command that is used to compress the files and collect all the files in a single archive folder for easy storage and transport is done by zip. The zip command always supports the encryption and you need to add – – encrypt option.
$ zip – – encrypt BigFile.zip BigFile
The zip does both encryption and compression just like gpg. The file size after the zip command will become smaller than the original.
- 7z
The 7z command work similarly to zip but the compressing of files ratio is surprisingly different. The 7z command can encrypt many files into one encrypted archive file just like zip. The encryption password needs to mention in the command like following the – p option.
$ 7z a BigFile.7z BigFile – phard2gue$$
- Ccrypt
The ccrypt tool that is based on Rijndael block cipher helps in encryption and decryption of files. It is believed that ccrypt provides very strong security and easy to run the files in the command line. Ccrypt encrypt the original file in its place. It does not change file size and date or time of the file to reflect the time of encryption when it was performed. A single ccrypt command can encrypt the multiple files but they encrypt separately.
- Mcrypt
The commands that prompt for a password twice is mcrypt. It changes the file permission and leaves the original file intact. The encrypted file provides access to read and write only to the file owner. The compressing of file option is also offered by mcrypt command before encryption and provides a variety of choices concerning encryption algorithms. The default encryption algorithm of ccrypt command appears to be is rijndael-128.
- Bcrypt
Bcrypt is based on Blowfish cipher which is the function of its key derivation. It is not majorly recommended to use Blowfish cipher as since the time it was not figured that the cipher algorithm can be attacked.
- VeraCrypt
VeraCrypt is a unique and interesting encryption system. The usage of this system straightforward after setting up. VeraCrypt encrypts the entire virtual volume that is created. It is considered as another storage device when mounted in the right way. You can copy files to and from the device in a usual manner but nothing will there if it is unmounted. The file encrypted becomes blurred and binary. No one can read this.
- Tails OS
OS itself creates the privacy-oriented user experience. This is called an ‘amnesic incognito live system’. This can only be accessed by using an external USB drive on a host computer. In the next boot if any change made on usage then it will automatically have reversed.
HOW TO ENCRYPT A FOLDER?
The folders can be encrypted by using a file manager or gpg-zip command. The process of encryption of file folders in the file managers is the same as the encryption of a single file. The one point that may differ and asked that you want to encrypt the file separately or together in a package.
Use the gpg-zip command for encrypting file folder:
– Encrypt a folder for example – Document directory so the command will be
gpg-zip –c –o Documents.gpg Documents
– Type and verify an encryption passphrase after prompted.
– The decryption of the encrypted folder will be done in the same manner and you can use the command
gpg Documents.gpg.
– After this command file will be decrypted.