Situatie
eCryptfs is a powerful encryption tool for Linux that allows users to encrypt and decrypt files and directories on their system. It is a popular option for securing sensitive data on Linux systems.
Install eCryptfs
eCryptfs is already included in the official Ubuntu repositories, so we can install it using the apt command. Open the Terminal in your Ubuntu system by pressing Ctrl+Alt+T. Now in the Terminal, execute this command to install eCryptfs:
$ sudo apt install ecryptfs-utils –y
Encrypt Directories using eCryptfs
For instance, I want to encrypt the “Myfiles” directory under my Home directory. In this case, the command would be:
When you run the above command, you will be asked to provide some details along with passphrase. The passphrase is actually the encryption key that will be used to later to decrypt the encrypted directory.Also, note that the details you provide will be later used when remounting the directory.
Now the directory is encrypted and mounted. You can verify it by running the following command:
Verifying Encryption
Let’s create a document in the mounted directory using the Nano editor.
Now add some text in the file and press Ctrl+O and Ctrl+X to save and exit the file respectively. Now try to view this document using the cat command:
You will see that the document is unencrypted and you can view the content. It is due to the reason that the directory is mounted at this time. Remember that as long as the directory is mounted, you will be able to see the content unless you unmount it.
Now let’s try unmounting the directory. Use the following syntax to do so:
In this case, it would be:
As the directory is unmounted, so now let’s view the document using the cat command. This time, you will not be able to view the original content. Instead, you will see the encrypted text.
Leave A Comment?