16 C
Texas
angeloma
Senior Writer and partner

Protect your files on Linux with Tomb

The privacy of our documents is not something to be taken lightly. Because it is possible that one day an intruder might steal our data. In this article, I will show you how to protect your files on Linux with Tomb.

You’ve probably heard about encrypting files on Linux. First of all, it is good to say that this is a great way to protect your files as you can create a key file and a password to access them, that is, double security.

To do the above, there are several applications, but one of it of Tomb. Tomb is a 100% free and open source system for file encryption on GNU/Linux, facilitating the backup of secret files.

Tomb generates encrypted storage folders to be opened and closed using their associated key files, which are also protected with a password chosen by the user. So, if you want to protect your files and folders on Linux, then Tomb is a great option.

- Advertisement -

Let’s install it.

Install Tomb on Linux

Tomb, for now, is only available for Linux. So, if you use Arch Linux, your installation is reduced to running a single command. If you use Debian, Ubuntu, and derivatives you have to add a repository.

For Arch Linux

:~$ yay -S tomb gtomb

For Debian 9, Ubuntu 18.04 and Ubuntu derivates it is necessary to add the SparkyLinux repository. First, open a terminal and create a repo.list file.

:~$ sudo nano /etc/apt/sources.list.d/sparky-repo.list

Next, add the following:

deb https://sparkylinux.org/repo stable main
deb-src https://sparkylinux.org/repo stable main
deb https://sparkylinux.org/repo testing main
deb-src https://sparkylinux.org/repo testing main

1.- Adding the SparkyLinux repository
1.- Adding the SparkyLinux repository

Save and close the file. Then, download the GPG key and add it to APT.

:~$ wget -O - https://sparkylinux.org/repo/sparkylinux.gpg.key | sudo apt-key add -

2.- Adding the GPG key
2.- Adding the GPG key

Next, refresh the APT cache.

:~$ sudo apt update

3.- Running apt update command
3.- Running apt update command

Finally, install tomb package.

:~$ sudo apt install tomb

4.- Install tomb
4.- Install tomb

That’s it. Now, let’s use it.

Protect your files with Tomb

tomb allows you to encrypt folders and files through a file that serves as a key. This, in turn, is protected with a password. Encrypted folders are called tombs. Then, let’s create an example.

I will create a tomb called osradar with size 150MB. Remember a tomb is a folder. You must run the commands as root user.

Note: it is necessary to deactivate the swap partition.

:~$ sudo swapoff -a

5.- Deactivating the swap partition
5.- Deactivating the swap partition

:~$ sudo tomb dig -s 150 osradar.tomb

6.- Creating a new tomb
6.- Creating a new tomb

As I said before, the tomb is protected by a key file. Create it.

:~$ sudo tomb forge osradar.tomb.key

7.- Creating the key file
7.- Creating the key file

Then, you will have to enter the key file password twice.

8.- Setting a password for the keyfile
8.- Setting a password for the key file

Finally, you will see this.

9.- Keyfile created
9.- Keyfile created

The next step is to lock the folder with the key file. You have to type the password.

:~$ sudo tomb lock osradar.tomb -k osradar.tomb.key

10.- Locking the tomb with the keyfile
10.- Locking the tomb with the key file

Next, you will see this.

11.- The tomb is locked
11.- The tomb is done. You can protect your files now.

Opening the tomb

So, you know how to protect your folder with the key file. However, there’s still how to open it, why else, what’s the point?

You need to run this command and type the password.

:~$ sudo tomb open osradar.tomb -k osradar.tomb.key

12.- Entering the password
12.- Entering the password

13.- Opening a tomb
13.- Opening a tomb

And you will open the folder normally.

14.- The folder has mounted
14.- The folder has been mounted

Finally, when you finish working with the tomb, close it.

:~$ sudo tomb close

15.- Closing the tomb
15.- Closing the tomb

If you have many tombs opened.

:~$ sudo tomb slam all

So, that’s it.

Conclusion

It’s never too much work to protect your files on Linux. Especially if they are private files that you don’t want anyone to be able to open. To do this, you have a simple tool like tomb that is very powerful and few commands let you encrypt a folder where you can store the most important things on your computer.

About security, we also talked about Buttercup a password manager. You can read it here.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article