It's possible to encrypt and decrypt files and directories in Linux in a simple way, although there are many projects and methods for doing so. We've already discussed LUKS, eCryptFS, and many other tools. Now we'll introduce you to a simple but effective tool for encrypting your computer's contents called ash . We'll also describe its installation and basic operation step by step in this mini-tutorial.
Why do I need encryption? The answer is simple: for security . This way, an unauthorized third party cannot access the files and directories on our computer unless they know the password or passphrase to decrypt them (or there is some kind of vulnerability, like with MD4). Or rather, they could access the files, but all they would see is the encrypted content, which is completely incomprehensible to a human, instead of the plain text or any other content the encrypted file might have contained.
With ash, we can encrypt our files and directories using AES-256-CBC encryption , a very secure system. Specifically, ash is a modular framework for Bash written to be simple and usable from the command line (CLI). For installation:
curl https://raw.githubusercontent.com/ash-shell/ash/master/install.sh | sh ash apm:install https://github.com/ash-shell/cipher.git
Once installed, the next step is to start working with it. It's as simple as typing the following if you want to encrypt a file like example.txt:
ash cipher:e ejemplo.txt
It will ask for the encryption password and then generate an example.enc file. If we try to access it, we'll see that its contents are a jumble of meaningless alphanumeric symbols. To decrypt it, all we have to do is:
ash cipher:d ejemplo.enc
And now we have it as before… For directories it is exactly the same , replacing example.txt or example.enc with directory_name/ and directory_name.tar.gz.enc.