The ccrypt
utility is a security tool that encrypts and decrypts files and streams on demand. It uses the Advanced Encryption Standard (AES), which is considered very secure. For the moment, it's considered to be unbreakable and is a government standard. When you encrypt a file using ccrypt
, a password is required. It is best if you continue to use complex passwords for ccrypt
encryption because someone might still try.
Using ccrypt
is easy enough for encrypting, decrypting, and viewing an encrypted file's contents. I found the rpm on Sourceforge. Be sure to get the 1.11 or later package. Install the ccrypt-1.11
package in the usual way.
$ sudo rpm -i ccrypt-1.11-1.x86_64.rpm
Once installed, you have a few new apps on your system: ccrypt
, ccat
, ccencrypt
, ccdecrypt
, and ccguess
. The only two actual programs are ccrypt
and ccguess
. The others are links to ccrypt
with their respective options embedded. For example, you can use ccencrypt
or ccdecrypt
without knowing any ccrypt
options for encrypting or decrypting a file. And ccat
decrypts and displays the contents of a file without extracting the original file from the encrypted one. The ccguess
application can help recover your encryption password if you remember a part of it.
[ Want to learn more about security? Check out the IT security and compliance checklist. ]
ccencrypt
The ccencrypt
command encrypts a file using a key (password or passphrase).
$ cat file1.txt
This is a test of the ccrypt utility
$ ccencrypt file1.txt
Enter encryption key:
Enter encryption key: (repeat)
$ ls
file1.txt.cpt
You must enter your encryption key twice to confirm that you know it. Then your file is encrypted and is appended with a .cpt
extension. You can copy your encrypted file or move it and it remains encrypted.
cp file1.txt.cpt file2.txt
$ cat file2.txt
?\?mn???&?ꋄ???n????K?B?^+^?Ҧl?EEn??? ?2?u??t?=??=??`ʽ??c
$ file file2.txt
file2.txt: PGP\011Secret Sub-key -
ccdecrypt
Issue the ccdecrypt
command to decrypt and extract the original file from the encrypted one.
$ ccdecrypt file2.txt
Enter decryption key:
$ ls
file1.txt.cpt file2.txt
$ cat file2.txt
This is a test of the ccrypt utility
Notice that although file2.txt
is a copy of file1.txt.cpt
, when decrypted it remains file2.txt
and does not revert back to file1.txt
.
ccat
The ccat
utility is one of my favorites because it allows me to check the encrypted file contents but doesn't extract the contents.
$ ccat file1.txt.cpt
Enter decryption key:
This is a test of the ccrypt utility
$ ls
file1.txt.cpt file2.txt
The encrypted file, file1.txt.cpt
, is left encrypted and intact.
ccguess
I like the ccguess
command but I also hate it. I like it because it can help recover a forgotten key, but I hate it because it could compromise security in the wrong hands. Here's an example of how it works. When I encrypted file1.txt
, I used the key goonygoogoo to protect it. Yes, it's not a great password (key), but it's one I'll remember. But if I forget, I might remember that it has the word 'goo' in it.
ccguess file1.txt.cpt
Enter approximate key: goo
Generating patterns...1..2..3..4..5..sorting...done.
***g*o 818434604
Possible match: oLK@gw (5 changes, found after trying 6313742182 keys)
As you can see, even a relatively simple key couldn't be cracked even with a prompt that contained a good portion of the key. Could this key stand up to a brute force attack? Probably not, so use long, complex keys or key phrases for added protection.
Wrap up
The ccrypt
utility "suite" is an excellent tool for encrypting and decrypting your files. Here you got a small sampling of what the utility can do for you. There are many more options, which you can explore with this one, but these are the ones I've used most. You also got a glimpse of the ccguess
utility that might come in handy should you ever need it. Let's hope you don't, especially if you don't remember a large portion of the key.
À propos de l'auteur
Ken has used Red Hat Linux since 1996 and has written ebooks, whitepapers, actual books, thousands of exam review questions, and hundreds of articles on open source and other topics. Ken also has 20+ years of experience as an enterprise sysadmin with Unix, Linux, Windows, and Virtualization.
Follow him on Twitter: @kenhess for a continuous feed of Sysadmin topics, film, and random rants.
In the evening after Ken replaces his red hat with his foil hat, he writes and makes films with varying degrees of success and acceptance. He is an award-winning filmmaker who constantly tries to convince everyone of his Renaissance Man status, also with varying degrees of success and acceptance.
Parcourir par canal
Automatisation
Les dernières nouveautés en matière d'automatisation informatique pour les technologies, les équipes et les environnements
Intelligence artificielle
Actualité sur les plateformes qui permettent aux clients d'exécuter des charges de travail d'IA sur tout type d'environnement
Cloud hybride ouvert
Découvrez comment créer un avenir flexible grâce au cloud hybride
Sécurité
Les dernières actualités sur la façon dont nous réduisons les risques dans tous les environnements et technologies
Edge computing
Actualité sur les plateformes qui simplifient les opérations en périphérie
Infrastructure
Les dernières nouveautés sur la plateforme Linux d'entreprise leader au monde
Applications
À l’intérieur de nos solutions aux défis d’application les plus difficiles
Programmes originaux
Histoires passionnantes de créateurs et de leaders de technologies d'entreprise
Produits
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Services cloud
- Voir tous les produits
Outils
- Formation et certification
- Mon compte
- Assistance client
- Ressources développeurs
- Rechercher un partenaire
- Red Hat Ecosystem Catalog
- Calculateur de valeur Red Hat
- Documentation
Essayer, acheter et vendre
Communication
- Contacter le service commercial
- Contactez notre service clientèle
- Contacter le service de formation
- Réseaux sociaux
À propos de Red Hat
Premier éditeur mondial de solutions Open Source pour les entreprises, nous fournissons des technologies Linux, cloud, de conteneurs et Kubernetes. Nous proposons des solutions stables qui aident les entreprises à jongler avec les divers environnements et plateformes, du cœur du datacenter à la périphérie du réseau.
Sélectionner une langue
Red Hat legal and privacy links
- À propos de Red Hat
- Carrières
- Événements
- Bureaux
- Contacter Red Hat
- Lire le blog Red Hat
- Diversité, équité et inclusion
- Cool Stuff Store
- Red Hat Summit