Skip to content

Commit 3a68844

Browse files
docs: consolidate key backup info in borg key export, fixes #6204
Consolidate key backup documentation into `borg key export` and reference it from Quickstart and FAQ to avoid duplication and inconsistency. Clarify that while `repokey` or `authenticated` mode stores the key in the repo, a separate backup is still recommended to protect against repository corruption or data loss.
1 parent df081ca commit 3a68844

3 files changed

Lines changed: 23 additions & 28 deletions

File tree

docs/faq.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,10 @@ How important is the $HOME/.config/borg directory?
381381
The Borg config directory has content that you should take care of:
382382

383383
``keys`` subdirectory
384-
All your borg keyfile keys are stored in this directory. Please note that
385-
borg repokey keys are stored inside the repository. You MUST make sure to have an
386-
independent backup of these keyfiles, otherwise you cannot access your backups anymore if you lose
387-
them. You also MUST keep these files secret; everyone who gains access to your repository and has
388-
the corresponding keyfile (and the key passphrase) can extract it.
384+
All your borg keyfile keys are stored in this directory. Please note that borg
385+
repokey keys are stored inside the repository. In any case, you MUST make sure
386+
to have an independent backup of the borg keys, see :ref:`borg_key_export` for
387+
more details.
389388

390389
Make sure that only you have access to the Borg config directory.
391390

docs/quickstart.rst

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -350,18 +350,8 @@ For automated backups the passphrase can be specified using the
350350
.. warning:: The repository data is totally inaccessible without the key
351351
and the key passphrase.
352352

353-
Make a backup copy of the key file (``keyfile`` mode) or repo config
354-
file (``repokey`` mode) and keep it at a safe place, so you still have
355-
the key in case it gets corrupted or lost. Also keep your passphrase
356-
at a safe place. You can make backups using :ref:`borg_key_export`
357-
subcommand.
358-
359-
If you want to print a backup of your key to paper use the ``--paper``
360-
option of this command and print the result, or print this `template`_
361-
if you need a version with QR-Code.
362-
363-
A backup inside of the backup that is encrypted with that key/passphrase
364-
won't help you with that, of course.
353+
In any case, make a backup of the borg key, see :ref:`borg_key_export` for
354+
more details.
365355

366356
.. _template: paperkey.html
367357

src/borg/archiver/key_cmds.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,27 +135,33 @@ def build_parser_keys(self, subparsers, common_parser, mid_common_parser):
135135

136136
key_export_epilog = process_epilog(
137137
"""
138+
This command backs up the borg key.
139+
138140
If repository encryption is used, the repository is inaccessible
139-
without the key. This command allows one to back up this essential key.
141+
without the borg key (and the passphrase that protects the borg key).
142+
If a repository is not encrypted, but authenticated, the borg key is
143+
still needed to access the repository normally.
144+
145+
For repositories using **keyfile** encryption the key is kept locally
146+
on the system that is capable of doing backups. To guard against loss
147+
or corruption of this key, the key needs to be backed up independently
148+
of the main data backup.
149+
150+
For repositories using **repokey** encryption or **authenticated** mode
151+
the key is kept in the repository. A backup is thus not strictly needed,
152+
but guards against the repository becoming inaccessible if the key is
153+
corrupted or lost.
154+
140155
Note that the backup produced does not include the passphrase itself
141156
(i.e. the exported key stays encrypted). In order to regain access to a
142157
repository, one needs both the exported key and the original passphrase.
158+
Keep the exported key and the passphrase at safe places.
143159
144160
There are three backup formats. The normal backup format is suitable for
145161
digital storage as a file. The ``--paper`` backup format is optimized
146162
for printing and typing in while importing, with per line checks to
147163
reduce problems with manual input. The ``--qr-html`` creates a printable
148164
HTML template with a QR code and a copy of the ``--paper``-formatted key.
149-
150-
For repositories using keyfile encryption the key is saved locally
151-
on the system that is capable of doing backups. To guard against loss
152-
of this key, the key needs to be backed up independently of the main
153-
data backup.
154-
155-
For repositories using the repokey encryption the key is saved in the
156-
repository in the config file. A backup is thus not strictly needed,
157-
but guards against the repository becoming inaccessible if the file
158-
is damaged for some reason.
159165
"""
160166
)
161167
subparser = key_parsers.add_parser(

0 commit comments

Comments
 (0)