GithubHelp home page GithubHelp logo

encrypted-backups's Introduction

encrypted-backups

Backup directories in compressed encrypted form

Supports delta backup of individual directories, zipping up the directories and also optionally encrypting them. This is supported for *nix platforms only.

Prerequisites

  • Python 3

Install the missing modules using easy_install or pip.

For encryption, you need GPG

OSX

brew install gpg

Linux

apt install gpg

Then install pip install python-gnupg

Script

./backup_folders.py -h
usage: backup_folders.py [-h] [-e EXCLUDE] [-l LOGFILE] [-q] [-z]
                      [-zn ZIPNAME] [-zd] [-u USEREMAIL]
                      BACKUPDIR DESTINATIONDIR

positional arguments:
 BACKUPDIR             Specify the source directory to backup.
 DESTINATIONDIR        Specify the directory where the backup is stored.

optional arguments:
 -h, --help            show this help message and exit
 -e EXCLUDE, --exclude EXCLUDE
                       Exclude the following directories from backup.
 -l LOGFILE, --logfile LOGFILE
                       Specify the logfile.
 -q, --quiet           Do not print to stdout.
 -z, --zip             Create tgz file for the directory
 -zn ZIPNAME, --zipname ZIPNAME
                       Create named tgz file for the directory
 -zd, --zipdel         Create tgz file for the directory and delete the directory
 -u USEREMAIL, --encruseremail USEREMAIL
                       email-id for encryption purposes

Examples

# Backup 'my_dir_one' to '~/backup/full', logging to backup.log
$ ./backup_folders.py -l backup.log ~/Documents/my_dir_one ~/backup/full/

# Backup 'my_project' to '~/backup/full' skipping any directory with name 'target'
$ ./backup_folders.py -e target -l backup.log ~/Documents/code/github/my_project ~/backup/full/

# Backup 'my_dir_one' to '~/backup/full' in Quiet mode, logging to backup.log
$ ./backup_folders.py -q -l backup.log ~/Documents/my_dir_one ~/backup/full/

# Backup directory and also create a named tgz file called backup1.tgz
$ ./backup_folders.py -q -z -e target -l backup.log -zn backup1 ~/Documents/code/github/my_project ~/backup/full/

# Backup directory and also create a tgz file and delete the directory from backup folder
$ ./backup_folders.py -q -z -zd -e target -l backup.log ~/Documents/code/github/my_project ~/backup/full/

With encryption

You need to run create_keys.py once to generate the gpg public/private keys. This is created under $HOME/.gpghome

# Create one time config with email-id with given password
$ ./create_keys.py user@domain
  Password:

# Creating the backup
$ ./backup_folders.py -q -e target -l backup.log -u user@domain ~/Documents/code/github/my_project ~/backup/encrypted/

# Decrypting the file. This will generate my_project.tgz in ~/backup/encrypted directory.
$ ./decrypt_file.py ~/backup/encrypted/my_project.tgz.gpg
Password: *****

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.