First you have to create a gpg key for generating the backups. Either you generate a key without passphrase to allow for automatic backups or you specify the passphrase on the command line when running backups.
## Key without passphrase
Generate the key:
```bash
$ gpg --quick-gen-key--passphrase"" backup
```
To export the key to a file first list the keys:
```bash
$ gpg -K
```
Then export the one you want with:
```bash
$ gpg --export$KEYID>/tmp/key.export
```
This can then be imported on the target machine via:
```bash
gpg --import </tmp/key.export
```
## Key with passphrase
Same as above but without the `--passphrase` part.
# Create the backup
Create the batch file for the backup.
```bash
#!/bin/bash
TARGET='rsync://backup@$DOMAIN/$PATH'
KEY='--encrypt-key $key'
# create the backup, incrementally and a full one every month