Tuesday, 6 November 2018

How to Encrypt/Decrypt Files in CentOS7/RHEL7 using Ccrypt



Ccrypt is a command line utility for encryption and decryption of files and streams in Linux [CentOS 7]. It is a light weighted tool and available in EPEL repository (Extra Packages for Enterprise Linux) for Cent OS 7 and RHEL.
Installation of Ccrypt utility: follow the tutorial How to install Ccrypt in CentOS 7 / RHEL 7 if this is not installed already.

Files encryption: Run the following command to encrypt files and enter an encryption key:

[root@linuxcnf ~]# ccrypt filename
Enter encryption key:
Enter encryption key: (repeat)
[root@linuxcnf ~]#

Verify the file encryption: Run the following command to check the file status:

[root@linuxcnf ~]# ls -ld filename.cpt
-rw-r--r-- 1 root root 66 Nov  6 17:25 filename.cpt
[root@linuxcnf ~]#

Files decryption: Run the following command to decrypt the file and also enter the correct key:

[root@linuxcnf ~]# ccrypt -d filename.cpt
Enter decryption key:
[root@linuxcnf ~]#

Verify the file decryption: Run the following command to check the file status:

[root@linuxcnf ~]# ls -ld filename
-rw-r--r-- 1 root root 34 Nov  6 17:25 filename
[root@linuxcnf ~]#

It’s done!!!

No comments:

Post a comment