Home > General > How To: Encrypt / Decrypt a single file

How To: Encrypt / Decrypt a single file

September 16th, 2010 Leave a comment Go to comments

If you’re like me, you probably have lots of text files stored in your home directory containing sensitive data such as passwords and notes. Many times, home directories are exposed to other users that intentionally snooping around for that sort of data.

Well, have no fear! You can simply use gpg to encrypt / decrypt on the fly:

$ gpg -c  my_passwords.txt

Enter passphrase that you can remember to dencrypt with again. This’ll also generate a file called my_passwords.txt.gpg so go ahead and delete the original my_passwords.txt!

Now you’re ready to view/edit the file again. Run the following command to decrypt:

$ gpg my_passwords.txt.gpg

Enter your passphrase to generate my_passwords.txt file. Now simply use your favorite editor to view/edit the file.

Categories: General Tags:
  1. No comments yet.
  1. No trackbacks yet.