Using ccrypt Command- Encrypt/Decrypt Files In Linux

ccrypt command in Linux is actually a tool for users allowing them to encrypt or decrypt files. This command is technically based on Rijndael cipher. It’s actually the same cipher that is used in AES standard cryptography. Although, the AES standard uses a block size of 128-bit, but the ccrypt uses a 256-bit block size. The files once encrypted by ccrypt, an extension .cpt is added to files.

Ccrypt is beneficial for uses because:

  • It’s a light tool, so its installation and usage is quite easy.
  • It’s designed to overcome all shortcomings of standard UNIX crypt tool.

How to install ccrypt on Linux?

In order to install ccrypt on an Ubuntu Linux platform, just run a single command on terminal as mentioned:

sudo apt-get install ccrypt

Options available to use with ccrypt

  • -e | -encrypt: Used for encrypting a specified file and suffix the output with .cpt. If no files are specified, it runs as a filter.
  • -d | -decrypt: Used for decrypting a specified file and strips the .cpt suffix. If no files are specified, runs as a filter.
  • -c | -cat: Used to decrypt one or multiple files to standard output.
  • -x | -keychange: Used for changing the key for encrypted data. When it runs, asks basically for two passwords, the old and the new ones.
  • -u | -unixcrypt: Used for simulating the old UNIX crypt command.
Also Read:   Using bzdiff Command In Linux- Examples

How to encrypt files with ccrypt?

In order to encrypt a specified file using ccrypt command, user can run the following syntax:

ccrypt file_name

Means, if you want to encrypt a file named servo.txt, you can run the following command. Once you run it, you will be prompted to enter password. After the completion, it will remove the original file and save the new one with .cpt extension.

ccrypt servo.txt

How to decrypt files using ccrypt?

Similar to encrypt, the decryption process can also be performed using ccrypt command and the syntax to do so is here mentioned.

ccrypt -d file_name.cpt

Means, suppose you have an encrypted file named servo.cpt, whose password is “xyz”, then you can decrypt it with:

ccrypt -d servo.cpt

After you run this command, it will ask you to enter the password as aforementioned to decrypt it to standard output.

Nishant

Nishant Verma is a senior web developer who love to share his knowledge about Linux, SysAdmin, and more other web handlers. Currently, he loves to write as content contributor for ServoNode.