If you are a Raspberry Pi user and are interested in performing file encryption and decryption on your device, you should need to install the age command, which is pretty helpful in terms of securing your files.
Installing the age Command Line Utility to Encrypt/Decrypt files on Raspberry Pi
You cannot directly use the age command on the Raspberry Pi operating system because its repository isn’t included in the official source list of Raspberry Pi. However, you can manually download the tar.gz file and install it on your system using the following steps:
Step 1: Download the age tar.gz File
To install the age command on Raspberry Pi, you will first need to retrieve the tar.gz file from the GitHub website using the following command:
Step 2: Extract age tar.gz File Contents
Once the above tar.gz file is downloaded on Raspberry Pi, you can extract the contents using the following command:
Step 3: Move age and age-keygen Files to Bin Directory
Next, you will need to move the age file to the location “usr/local/bin” through the following command:
You will also need to move the age-keygen to the same location where age file is stored by executing the following command:
After moving the files to the “usr/local/bin” location, you can confirm the successful installation of age command on Raspberry Pi by checking the version using the following command:
Step 4: Testing the age Command on Raspberry Pi
After successfully installing the age command on Raspberry Pi, it’s now time to create a file for testing purpose so that you can understand how to encrypt files through this command:
In the above command, you can replace the name and content of the file with your own choice.
Step 5: Generate Public Key Using the age-keygen Command
Next, you will need to use the “age-keygen” command to successfully generate a public key for encrypting the data and a private key for decrypting the data on Raspberry Pi and to do that, you have to execute the following command:
It’s important to note the above command only show you the public key, however, with the file both public and private keys are created and if you want to view them, you can execute the following command:
Step 6: Encrypt File on Raspberry Pi Using the age Command
Now, to encrypt the file on Raspberry Pi, you can use the following syntax with the file name that you want to encrypt.
Step 7: Decrypt File on Raspberry Pi Using the age Command
To decrypt the file on Raspberry Pi, you can use the following syntax with the name of the file you have created in Step 4.
In this way, you can successfully encrypt and decrypt files on Raspberry Pi through age command.
Removing the age Command Utility From Raspberry Pi
To remove age command from Raspberry Pi, you can remove the age and age-keygen files from the location “usr/local/bin” through the following commands:
File encryption on Raspberry Pi is extremely useful for users who want to protect their important data from external attacks. The Raspberry Pi users can use the age command to perform file encryption and decryption on their devices. The step-by-step explanation to install and use the age command is provided in the above guidelines. If you follow them, you can perform file encryption and decryption efficiently on your Raspberry Pi device.