---
title: "How to Configure Backing Up to S3 with Duplicity | Hostman Docs"
description: "Back up to S3 object storage with Duplicity following Hostman’s guides. You'll secure and reliable storage for your data."
---

> For the complete documentation index for AI agents, see [llms.txt](https://hostman.com/llms.txt).

Duplicity is a command-line utility for backup and recovery. Backups can be uploaded to storage using protocols such as SCP, SFTP, WebDAV, [S3](https://hostman.com/products/s3-storage/), Swift, and others. By default, the utility encrypts backups using GnuPG.

Below is an example of setting up Duplicity for backing up data to Hostman object storage using the Swift protocol.

1.  Create a separate bucket for backups.
    
2.  Install the duplicity package on the server along with the required dependencies.
    
    -   For Duplicity versions below 0.8.x (which use Python 2), you need the `python-swiftclient` package.
        
    -   For Duplicity version 0.8.x and above, install `python3-swiftclient`.
        

Use the following commands:

```shell
sudo apt-get install duplicity
```

3.  Create a file named `backup.sh` with the following content, replacing the variable values with your actual credentials. You can find them in the **Swift parameters** section in your bucket **Settings**.
    

```bash
#!/usr/bin/env bash

export SWIFT_PASSWORD="storage_password"
export SWIFT_AUTHVERSION=2
export SWIFT_TENANTNAME="account_login"
export SWIFT_USERNAME="account_login"
export SWIFT_AUTHURL="URL"
export PASSPHRASE="encryption_password"

source=/home  # Path to the directory to be backed up
dest=bucket_name  # Destination bucket for backups

duplicity "$source" swift://"$dest"
```

4.  Run the following command to make the script executable:
    

```shell
chmod +x backup.sh
```

5.  Execute the script with the following command:
    

```shell
./backup.sh
```
