Encrypt your backup files for top security using GPG

Feb 07

Remember that you should have backups for your servers or web site. If a disaster strikes you can restore the data quickly and easily – you should keep the backup files SAFE, because backup usually includes system configuration, users, passwords and various other very important data. And by safe we mean that none except you can access it. We usually keep backup files on a remote server(s) to make sure no data backups are kept in one physical location.

For extra security we do encrypt backup files using gpg (Gnu Privacy Guard) a Linux command line software in our case. Gpg provides very high security level and encryption.

You can encrypt file using GPG:

gpg -c filename.tar

<enter password 2 x times>

If you are running gpg command first time a key may be generated before you can enter the password.

File unencryption can be done by:

gpg -c filename.tar.gpg

There you go 🙂

For folks who want to encrypt backup files or any other files using automated scripts use the following command:

echo PASSWORD_HERE | gpg –passphrase-fd 0 -c FILENAME_HERE

One Response to “Encrypt your backup files for top security using GPG”

  1. Hello, I know this is an old post- but dont you suppose encrypting with a public key would be safer ? If im not mistaken, the passhrase in this situation could be used to decrypt the files as well, can it not?

    Creating a gpg profile for the backup process means u can sign it and put it anywhere… encrypted with your public key ofcourse… which means- the only one who can decrypt the file is you and you can verify its authenticity…

    Forgive me if im wrong, im just starting to grasp gpg and pgp concept…

Leave a Reply