Tutorials

How to encrypt data in linux: ubuntu, linux mint ...

Table of contents:

Anonim

If you think your data is extremely important, then you should consider its security a priority and want to know how to encrypt data in Linux.

And with more and more companies working with multiple platforms, you have to be prepared to work with encryption in almost all businesses and this is where our beloved SAMBA- compatible Linux operating system appears to any operating system no matter what it is.

How to encrypt data in Linux

Privacy is difficult to maintain these days. Due to the security issues of Windows 10 , it's no wonder why so many people are flocking to Linux instead. If you are concerned about true privacy, Linux is your best bet.

And these days, true privacy is virtually impossible without the use of encryption, so encrypting your data is in your best interest.

We are going to show you six easy ways to encrypt your data. Prepared? Here we go!

Encrypt Linux data with GnuPG

GnuPG is the basis for all encryption that is handled in Linux. But GnuPG is not just a tool that works like others. Believe it or not, you can easily encrypt a file with GnuPG from the command line. The command to encrypt a file is:

gpg -c filename

Where "file name" is the name of the file to encrypt. The encryption will be attached to a.gpg file.

To decrypt a file, the command is:

file name gpg.gpg

This is the easiest and fastest way to encrypt files (by tapping the command line).

VeraCrypt

VeraCrypt is an improved version of TrueCrypt, as it works much more securely. TrueCrypt uses PBKDF2-RIPEMD160 with 1, 000 iterations, and VeraCrypt uses 327, 661 iterations. The graphical user interface for VeraCrypt is simple to use and guides you through the entire process of creating encrypted containers.

Creating, encrypting, mounting, and decrypting containers takes a little time. But the added time is worth it for the extra security you get.

We recommend you read our guide: What is a firewall or firewall?

Files

Files is the default file manager for GNOME and Ubuntu Unity. Within this easy-to-use tool is the ability to easily protect your files and folders with a low level of password encryption. Just select the compression file, select a compression format that works with encryption (like zip) , add a password, and compress.

When extracting the compressed file, you will be asked to enter the encryption password. Although this type of encryption is not as strong as what you would get with VeraCrypt, if you are looking for something quick and easy to use, this is what you need.

Encrypt disk partitions with LUKS

LUKS (Linux Unified Key Setup) can be thought of as an interface between the operating system and a physical data partition. When you want to read or write a file, LUKS handles encryption and decryption perfectly.

Note that there are several drawbacks to encrypting a disk partition to proceed with caution. At best it will impact overall performance, at worst it may happen that data recovery is impossible. Before encrypting a partition, be sure to back up your data .

To install LUKS, you will need the front-end utility:

sudo apt-get update sudo apt-get install cryptsetup

Distros (distributions) with YUM instead of APT can use:

yum install cryptsetup-luks

To configure LUKS, run this in terminal:

dd if = / dev / random of = / home / / basefile bs = 1M count = 128 cryptsetup -y luksFormat / home / / basefile cryptsetup luksOpen / home / / basefile volume1

Remember to replace with your own Linux account name.

With the LUKS container configured, you need to create a file system on top of it and mount it. In this case, the EXT4 file system is used:

mkfs.ext4 -j / dev / mapper / volume1 mkdir / mnt / mount files / dev / mapper / volume1 / mnt / files

Every time you turn on your computer, you will need to unlock and mount LUKS to make your encrypted partition available:

mkfs.ext4 -j / dev / mapper / volume1 mkdir / mnt / mount files / dev / mapper / volume1 / mnt / files

And every time you want to shutdown your PC, you will have to safely unmount and lock LUKS to re-encrypt the partition:

umount / mnt / cryptsetup files luksClose volume1

Please note that most modern Linux distributions allow you to configure all disk encryption using LUKS during the installation of the operating system. These days, it is the safest and easiest way to do all disk encryption.

Encrypt directories with eCryptfs

For most Linux users, doing a full disk encryption or encrypting a disk partition entirely is a bit of a stretch. Why encrypt everything when only the directories that contain your confidential information can be encrypted? It is faster and more comfortable, after all.

You can do this using a utility called eCryptfs, a utility that allows you to encrypt individual directories without having to worry about file systems, partitions, mounting, etc.

Using eCryptfs you can encrypt the entire root directory or encrypt any directory on your system (although you are generally going to choose a directory within your root directory, such as / home / /binder).

To get started, you will need to install eCryptfs:

sudo apt-get update sudo apt-get install ecryptfs-utils

For distros with YUM instead of APT you can use:

yum install ecryptfs-utils

Once installed, create the directory you want to use as the encryption. Don't use an existing directory as the files inside will be inaccessible after the directory is encrypted:

mkdir / home / /Directory

To encrypt the directory, mount the directory itself using ecryptfs:

mount-t ecryptfs / home / / Directory / home / /Directory

The first time you do this, you will have to configure encryption. Choose AES encryption, set the byte key to 32, choose "No" for the gateway plaintext, and select "No" to put an encrypted file name (unless you want to).

WE RECOMMEND YOU Cheap SDS: all the information

When unmounting the directory, none of the contents will be readable:

sudo umount / home / /Directory

Reassemble the directory to make your content accessible.

We recommend reading our review of Ubuntu 16.04 LTS.

Encrypt files with AESCrypt

Suppose you want to decrease and be more specific with your encrypted data. You don't need an entire disk partition or encrypted directory, all you need is the ability to quickly encrypt / decrypt individual files.

In that case, a free tool like AESCrypt is going to be more than enough for you. It comes with a graphical interface so you don't need to be a Linux expert to use it. It is quick and easy.

To install AESCrypt, you can download the installation script or the source code from the main page. However, for Ubuntu users, we recommend using the unofficial PPA repository:

sudo add-apt-repository ppa: aasche / aescrypt sudo apt-get update sudo apt-get install aescrypt

To encrypt a file, right click on it and select "Open with AESCrypt". You will be asked to enter a password. This will be necessary to decrypt the file later, so don't forget.

Encrypting a file produces a separate file with the AES extension, keeping the original file intact. Feel free to keep or delete the original.

To decrypt a file, click on the AES file and select "Open with AESCrypt". Enter the password that was used to encrypt the file. An identical copy will be produced separately.

You can also use the command line to encrypt:

sudo aescrypt -ep

And to decipher:

sudo aescrypt -d -p

Conclusion about encryption in Linux

In short, encryption really works to protect your data from onlookers, malicious people and intruders. It might seem a little difficult at first, but the learning curve is small and the rewards are great. And we ask you… What do you think of our tutorial on how to encrypt data? Are you interested in seeing one for Windows or another operating system? Thanks as always and that little finger up!

Tutorials

Editor's choice

Back to top button