In GNU/Linux, there are decent amount of tools with graphical interfaces that make file encrypting a breeze. However, there are also command-line based ones (few!) that let you easily encrypt/decrypt your data as well. Other than not having the ability to use the mouse (plus if you’re not a touch typist), most people don’t like command-line tools because they make you type a bit ;-).
But if you’re willing try a command-line based tool, as long is it lets you easily encrypt/decrypt data (without having to type a lot of commands), then you might be interested in “ccrypt“.
“ccrypt” only supports one algorithm known as “AES”, but it’s considered as an extremely powerful encryption method nonetheless (almost all the major tools support it by default).
It lets you encrypt anything under the sun ;-), whether it’s a MP3 file, document, compressed archive, video file … you name it. “ccrypt” has a handful of options too, but as said before, I just love the way it’s designed, because you can easily encrypt or decrypt a file with minimum efforts (commands). And not to say the least, it also requires very little of your system resources too.
In my honest opinion, it’s actually one of the best tools of its kind that I’ve used so far as well.
Few main features …
*. Only supports the AES encryption (256-bit) providing a powerful security over your sensitive data.
*. Lets you use a “key-file” as well. But it’s optional, and for most users, using a powerful password usually provides enough security.
*. By default, after encrypting a file, it deletes the source file. And I don’t think we can bypass that either.
Now this could be a bit of an issue for some. For instance, if you just forgot the newly added password to the encrypted file (yikes!) then you might never be able to access it!. So as a safety precaution, you can move all the files that you want to encrypt to a new folder and can delete the original files later.
*. You basically have two choices while decrypting. You can either permanently decrypt the file OR if it’s a text file for instance, then you can decrypt it temporarily and get the text output to your Terminal window (more at the end of the post).
That’s basically “ccyrpt” in a nutshell folks.
If interested, you can install “ccrypt” in Ubuntu 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04 Natty Narwhal, 10.10 and 10.04 by using the below command in your Terminal window.
sudo apt-get install ccrypt
Few simple examples (added forcefully ) …
1. Encrypting …
Let’s say that I have a mp3 file named “1″ in my Home folder, then I’d use something like the below command to encrypt it with “ccrypt”.
(Please replace “1.mp3″ with the name of your own file and its path).
Then it’ll ask for a new password (twice), and that’s it!. The “.cpt” extension will be added to the encrypted file and the original file will be deleted.
2. Decrypting …
Unlike while encrypting, when decrypting you’ll have to use the “-d” attribute, otherwise, “ccrypt” will try to re-encrypt it!.
So to decrypt the above mentioned file, I’d use a command like the below one.
ccrypt -d 1.mp3.cpt
Using the “.cpt” extension is not always necessary. However, as a safety precaution, when typing the encrypted file’s name, always use the added “.cpt” extension as well.
That’s the basic usage and for most users these are the two most important commands necessary (usually).
3. Decrypting a file and displaying its content into the Terminal window …
This is only useful for Text files … because other file types (video/audio, a program etc) won’t output a readable content.
So let’s say that I haven an encrypted text document called “test” and need to quickly open its content into the Terminal window (this again only decrypts the content temporarily and as soon as it outputs the content, the file will be encrypted back automatically), then I’d use a command like the below one (we’re using the built in “-c” attribute which enables this feature).
ccrypt -c test
This should output something like the below one (the output of course will change according to your text content).
Again, please replace “test” with the name of own your file and its path.
4. Using a “key-file” …
A key-file is sort of a long password that’s saved in plain text which is used for additional security. So let’s assume that I wanted to encrypted the above mentioned mp3 file using a key-file instead of a password. Then I’d use something like the below command (assuming the key-file’s name is “mykey” and both the key-file and the mp3 files are in my “Home” folder).
ccrypt -K mykey 1.mp3
Note: That’s capital “K”.
When you want to decrypt the file just use the default decrypt command, and when asked, type the key-file path and it should do the rest.
ccrypt -d 1.mp3.cpt
5. Changing passwords or the key-file …
If you wanted to change the passwords or the key-file with ease (rather than decrypting and then re-encrypting it using a new password/key-file), then you can use the “-x” attribute.
For instance, if I wanted to change the password/key-file of the above mentioned mp3 file without decrypting it, then I’d use a command like the below one.
ccrypt -x 1.mp3.cpt
When asked, first enter the old password and then the new one after that (twice). That’s it.
It has few other commands which might not be that necessary, but just in case ;-), use the below command to read its manual which explains everything quite well.
I apologize if my rambling has made it look like a complicated tool. But in truth, “ccrypt” is a pretty simple and a straightforward software application that can be used to encrypt and decrypt files with ease under Ubuntu (or GNU/Linux in general). Good luck.