Hey folks, here’s a fun little tidbit for you. Did you know that you can easily and quickly encrypt and decrypt files using one tiny little command on your super cool Linux or UNIX (Yes, OSX counts) and even Windows command line? For those that haven’t yet heard of it, it’s a command called ‘ccrypt’. Check it out …
First we need to install ccrypt on on your system. For Debian and Ubuntu (which is based on Debian), you can simply use the apt package manager to do this. Remember that you can use the -s flag to test or simulate the install before you actually go through with it in order to make sure there are no surprises waiting for you. Logged in as your un-privileged account, the command would look like this:
sudo apt-get -s install ccrypt
Assuming everything went off as planned, you could then run the real thing:
sudo apt-get install ccrypt
For Redhat (CentOS, and others based on Redhat), they have RPM packages available for download. Along with those they have Debian, Solaris (SPARC and i386), OS/2, SuSE, OpenBSD, and FreeBSD packages as well as pre-compiled binaries for lots of platforms and OS’s, so go crazy people!!
OK, now that you have the package installed, you can have some fun whiling away the afternoon encrypting and decrypting files like mad!
To encrypt a file, run this command:
ccrypt file_name
It’s just that easy.
Naturally, you would replace ‘file_name’ with your real file information. You will be asked to enter a key or password two times. Once complete, the encrypted file will have an extension of ‘.cpt’, and the original un-encrypted file will be replaced by the encrypted file.
To decrypt the file, run the same command the same way and simply add the -d flag.
ccrypt -d file_name
You will be asked for the encryption key or password that you gave it when you encrypted it in the first place, so don’t lose it! As always you can use the ‘–help’ flag or hit up the man pages for more detailed information. Hope you enjoy it!
**ALERT**
**Danger, Will Robinson!**
Cheesy I know, but I hope it’s working. One more time – please note that when you run the command to encrypt a file, the original source file, the un-encrypted file gets replaced by the newly encrypted file. So if you are simply making an encrypted copy for example, the original is gone. If you lose or forget the encryption key or password you will be out of luck. I’m sure it can be cracked by someone, but boy that would be a pain in the arse! So, keep that in mind when you encrypt a file, the file you are encrypting goes bye, bye! It works the same way when un-encrypting, but that’s not as potentially dangerous.