Skip to main content
Duplicity
Last update:

Duplicity

Duplicity — command line interface for backups. Duplicity supports SSH/SCP, FTP, HSI, WebDAV, Tahoe-LAFS and Amazon S3 protocols to connect to a file server, archives and uploads data to a local or remote file server, and encrypts data using a utility GnuPG.

Customize Duplicity

  1. Configure access.
  2. Install the client.
  3. Create a Duplicity configuration.

Set up access

Access can be configured by a user with role Account Owner or User Administrator.

Create a service user с a role with access to object storage. If you are using a user with the Object Storage User role, the container must be configured with the access policy.

Install the client

  1. Open the terminal.

  2. Set Duplicity:

    sudo apt-get install duplicity
  3. Install the packages python-swiftclient and librsync:

    sudo apt-get install python-swiftclient
    sudo apt-get install librsync-dev
  4. Install the Bazaar version control system and download the swiftbackend:

    sudo apt-get install bzr
    bzr branch lp:~mhu-s/duplicity/swiftbackend
  5. Set swiftbackend:

    cd swiftbackend && sudo python dist/setup.py install

Create a Duplicity configuration

  1. In a text editor, add a script for the backup:

    # Авторизационные данные для подключения к хранилищу
    SWIFT_PASSWORD="<password>"
    SWIFT_AUTHVERSION=2
    SWIFT_TENANTNAME="<username>"
    SWIFT_AUTHURL=https://<swift_domain>
    SWIFT_USERNAME="<username>"
    # Выполнение архивирования
    duplicity <path> swift://<container_name>

    # Очистка авторизационных данных для безопасности
    unset SWIFT_PASSWORD
    unset SWIFT_AUTHVERSION
    unset SWIFT_TENANTNAME
    unset SWIFT_AUTHURL
    unset SWIFT_USERNAME

    Specify:

    • <password> — the service user password. If you have forgotten the password, create a new;
    • <swift_domain> — Swift API domain depends on pool where the object storage is located;
    • <username> — service user name;
    • <path> — path to the folder on the local machine;
    • <container_name> — container name.
  2. Save the file and make it executable:

    chmod +x <file_name>

    Specify <file_name> — filename.

  3. Start executing commands from the file:

    ./<file_name>
  4. Specify a code word to access the files. The backup will start. The statistics will be displayed in the console.

  5. To download an encrypted backup from the repository to your local machine, copy the script from step 1.

  6. In the script, replace the command duplicity <path> swift://<container_name> on duplicity swift://<container_name> <path>.

  7. Save the script to a file named restore.sh and make it executable. When executing the command ./restore.sh you will be prompted for a code word. After entering the code word, all files from the backup will be downloaded to the specified directory on the local machine.