Friday, May 7, 2010

How to protect a password file in linux

A simple way to encrypt a file with a password is to use gpg (GnuPG). Suppose we have a file mysamplefile.txt, to encrypt it type the following on console.

$ gpg -c mysamplefile.txt

You will be asked to enter a paraphrase twice
A new file named mysamplefile.txt.gpg will be created.

To decrypt the file type
$ gpg mysamplefile.txt

Again it will ask the paraphrase and decrypt the file.

1 comment:

Elf Wizard said...

I have my own pwds, on a plain Calc file. I just have this file on a rarely mounted partition, so I mounting the partition and after copying the pwd, I dismounting again.

7zip (p7zip actually) has also the ability for encrypting files.

When I was at Windows, I was using TrueCrypt, but I think this is not a very good solution, for Linux world (due to the obscure licensing).

Just an alternate view. :-)