borg-key-change-passphrase(1)

Name
borg-key-change-passphrase - Changes the repository key file passphrase.

SYNOPSIS

borg [common options] key change-passphrase [options]

DESCRIPTION

The key files used for repository encryption are optionally passphrase protected. This command can be used to change this passphrase.

Please note that this command only changes the passphrase, but not any secret protected by it (like e.g. encryption/MAC keys or chunker seed). Thus, changing the passphrase after passphrase and borg key got compromised does not protect future (nor past) backups to the same repository.

OPTIONS

See borg-common(1) for common options of Borg commands.

EXAMPLES

    # Create a key file protected repository
    $ borg repo-create --encryption=aes-ocb --key-location=keyfile -v
    Initializing repository at "/path/to/repo"
    Enter new passphrase:
    Enter same passphrase again:
    Remember your passphrase. Your data will be inaccessible without it.
    Key in "/root/.config/borg/keys/mnt_backup" created.
    Keep this key safe. Your data will be inaccessible without it.
    Synchronizing index...
    Archives: 0, w/ index: 0, w/ outdated index: 0, w/o index: 0.
    Done.
    # Change key file passphrase
    $ borg key change-passphrase -v
    Enter passphrase for key /root/.config/borg/keys/mnt_backup:
    Enter new passphrase:
    Enter same passphrase again:
    Remember your passphrase. Your data will be inaccessible without it.
    Key updated

Note: The key file paths shown above are the defaults for Linux (~/.config/borg/keys/). On macOS, key files are stored in ~/Library/Application Support/borg/keys/. On Windows, they are stored in C:\Users\<user>\AppData\Roaming\borg\keys\. See env_vars for details.

    # Import a previously-exported key into the specified
    # key file (creating or overwriting the output key)
    # (keyfile repositories only)
    $ BORG_KEY_FILE=/path/to/output-key borg key import /path/to/exported

Fully automated using environment variables:

    $ BORG_NEW_PASSPHRASE=old borg repo-create --encryption=aes-ocb
    # now "old" is the current passphrase.
    $ BORG_PASSPHRASE=old BORG_NEW_PASSPHRASE=new borg key change-passphrase
    # now "new" is the current passphrase.

SEE ALSO

borg-common(1)

Author
The Borg Collective