Encrypt Files in Linux with Tomb

Introduction

In this tutorial, How to Encrypt Files in Linux with Tomb. It’s a simple shell script to allow you to encrypt folders and files in Linux.

  • The Tomb is a powerful encryption tool for Linux that allows users to create encrypted directories and files, providing an extra layer of security for sensitive data.
  • Tomb uses both GNU Privacy Guard to handle its encryption and dd to wipe and format its virtual partitions.

Installing Tomb in Ubuntu

sudo apt install -y tomb

How to encrypt Files in Linux with Tomb

First, you must use the dig subcommand to create a 150M Tomb file with “first-encrypt.tomb

tomb dig -s 150 first-encrypt.tomb
How to encrypt Files in Linux with Tomb

Next, You create a new key for the tomb file:

tomb forge -k first-encrypt.tomb.key
create a new key for tomb file

Second, You need to link the new key to your new tomb file as command below:

tomb lock -k first-encrypt.tomb.key first-encrypt.tomb
link the new key to your new tomb file as command below

The final, You can open a new locked tomb with the open subcommand below:

tomb open -k first-encrypt.tomb.key first-encrypt.tomb
open a new locked tomb with the open subcommand below

Create an image key to Encrypt files

Use the bury subcommand the combine my “first-encrypt.tomb.key” with the image.jpg

image 4

Now, You can open the tomb file using my new image key.

tomb open -k image.jpg first-encrypt.tomb

Close a tomb (fails if the tomb is being used by a process)

tomb close

Forcefully close all open tombs, killing any applications using them

tomb slam all

List all open tombs

tomb list
List all open tombs

How do expand the size of my first-encrypt.tomb file from 150MB to 1GB:

tomb resize -k first-encrypt.tomb.key -s 1000 first-encrypt.tomb
expand the size tomb command line

Search your tomb

tomb index # The first, In order to search through your tomb files.
tomb search test # after search your want to 

Conclusion

With Tomb, you can easily encrypt sensitive files and keep them secure on your Linux system. You know How to Encrypt Files in Linux with Tomb. I hope this will be helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology, especially Devops Skill such as Docker, vagrant, git, and so forth. I like open-sources, so I created DevopsRoles.com to share the knowledge I have acquired. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.