Backup shell script to backup selected directories and upload securely (gpg) to FTP server

Posted on in Categories Backup last updated April 9, 2008

This script requires GNU Privacy Guard – cryptographic software on Linux / UNIX systems. GnuPG encrypts messages using asymmetric keypairs individually generated by GnuPG users. The resulting public keys can be exchanged with other users in a variety of ways, such as Internet key servers. They must always be exchanged carefully to prevent identity spoofing by corrupting public key ↔ ‘owner’ identity correspondences. It is also possible to add a cryptographic digital signature to a message, so the message integrity and sender can be verified, if a particular correspondence relied upon has not been corrupted.

GnuPG does not use patented or otherwise restricted software or algorithms, including the IDEA encryption algorithm which has been present in PGP almost from the beginning. Instead, it uses a variety of other, non-patented algorithms such as CAST5, Triple DES, AES, Blowfish and Twofish. It is still possible to use IDEA in GnuPG by downloading a plugin for it, however this may require getting a license for some uses in some countries in which IDEA is patented.

GnuPG is a hybrid encryption software program in that it uses a combination of conventional symmetric-key cryptography for speed, and public-key cryptography for ease of secure key exchange, typically by using the recipient’s public key to encrypt a session key which is only used once. This mode of operation is part of the OpenPGP standard and has been part of PGP from its first version.

Shell Script

10 comment

  1. I have also written a backup script which can
    * Backup a selection of files and/or directories.
    * Dump MySQL databases.
    * Backup hidden configuration files of users’ homes.
    * Backup the list of installed packages (Debian).
    * Encrypt the final archive using GPG.
    * Upload final archive via FTP (using ftp-upload) and/or SCP.

    If someone is interested, then have a look on http://zyxbackup.blogspot.com/

  2. You need to add code as follows before
    # remove the files
    Add code to copy encrypted file to /home/backups
    /bin/cp $FOUT /home/backups

  3. What do you do to that script if you want one copy of the generated file somewhere on your system.
    i.e on /home/backups

    Many thanks.

Leave a Comment