mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
5a32de918e
Running 'borg key import' on a keyfile repository with the BORG_KEY_FILE environment variable set works correctly if the BORG_KEY_FILE file already exists. However, the command crashes if the BORG_KEY_FILE file does not exist: $ BORG_KEY_FILE=newborgkey borg key import /home/strager/borg-backups/straglum borgkey Local Exception Traceback (most recent call last): [snip] File "[snip]/borg/crypto/key.py", line 713, in sanity_check with open(filename, 'rb') as fd: FileNotFoundError: [Errno 2] No such file or directory: '[snip]/newborgkey' Platform: Linux straglum 5.0.0-25-generic #26~18.04.1-Ubuntu SMP Thu Aug 1 13:51:02 UTC 2019 x86_64 Linux: debian buster/sid Borg: 1.1.11 Python: CPython 3.7.7 msgpack: 0.5.6 PID: 15306 CWD: /home/strager/Projects/borg sys.argv: ['[snip]/borg', 'key', 'import', '/home/strager/borg-backups/straglum', 'borgkey'] SSH_ORIGINAL_COMMAND: None Make 'borg key import' not require the BORG_KEY_FILE file to already exist. This commit does not change the behavior of 'borg key import' without BORG_KEY_FILE. This commit also does not change the behavior of 'borg key import' on a repokey repository.
46 lines
1.5 KiB
ReStructuredText
46 lines
1.5 KiB
ReStructuredText
.. _borg-change-passphrase:
|
|
|
|
.. include:: key_change-passphrase.rst.inc
|
|
|
|
Examples
|
|
~~~~~~~~
|
|
::
|
|
|
|
# Create a key file protected repository
|
|
$ borg init --encryption=keyfile -v /path/to/repo
|
|
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 chunks cache...
|
|
Archives: 0, w/ cached Idx: 0, w/ outdated Idx: 0, w/o cached Idx: 0.
|
|
Done.
|
|
|
|
# Change key file passphrase
|
|
$ borg key change-passphrase -v /path/to/repo
|
|
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
|
|
|
|
# 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/repo /path/to/exported
|
|
|
|
Fully automated using environment variables:
|
|
|
|
::
|
|
|
|
$ BORG_NEW_PASSPHRASE=old borg init -e=repokey repo
|
|
# now "old" is the current passphrase.
|
|
$ BORG_PASSPHRASE=old BORG_NEW_PASSPHRASE=new borg key change-passphrase repo
|
|
# now "new" is the current passphrase.
|
|
|
|
|
|
.. include:: key_export.rst.inc
|
|
|
|
.. include:: key_import.rst.inc
|