Image

Knowledge base → Encrypting files in the Linux console

[Virtual servers]
Date of publication: 10.10.2023

There is an easy way to encrypt files in the Linux console.

1. Installing required packages

apt install mcrypt

2. File encryption

mcrypt my-passwords.txt

Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase: 

Enter your password and press Enter.


3. File decryption

mcrypt -d my-passwords.txt.nc

4. Encrypt multiple files

mcrypt file1.txt file2.txt

4.1 To encrypt a directory, it must first be archived

tar -czf my-own-data.tar.gz /home/user/My-Folder
mcrypt my-own-data.tar.gz

5. Decryption of multiple files

mcrypt -d file1.txt.nc file2.txt.nc

5.1 Decryption and unpacking of the archive

mcrypt -d my-own-data.tar.gz.nc
tar -xzvf my-own-data.tar.gz




No Comments Yet