generalusage.rst 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. .. include:: global.rst.inc
  2. .. _generalusage:
  3. General Usage
  4. =============
  5. The following examples showcases how to use |project_name| to backup some
  6. important files from a users home directory (for more detailed information
  7. about each subcommand see the :ref:`detailed_usage` section).
  8. Initialize a local :ref:`repository <repository_def>` to store backup
  9. :ref:`archives <archive_def>` in (See :ref:`encrypted_repos` and
  10. :ref:`remote_repos` for more details)::
  11. $ attic init /somewhere/my-backup.attic
  12. Create an archive containing the ``~/src`` and ``~/Documents`` directories::
  13. $ attic create -v /somwhere/my-backup.attic::first-backup ~/src ~/Documents
  14. Create another archive the next day. This backup will be a lot quicker since
  15. only new data is stored. The ``--stats`` option tells |project_name| to print
  16. statistics about the newly created archive such as the amount of unique data
  17. (not shared with other archives)::
  18. $ attic create -v --stats /somwhere/my-backup.attic::second-backup ~/src ~/Documents
  19. List all archives in the repository::
  20. $ attic list /somewhere/my-backup.attic
  21. List the files in the *first-backup* archive::
  22. $ attic list /somewhere/my-backup.attic::first-backup
  23. Restore the *first-backup* archive::
  24. $ attic extract -v /somwhere/my-backup.attic::first-backup
  25. Recover disk space by manually deleting the *first-backup* archive::
  26. $ attic delete /somwhere/my-backup.attic::first-backup
  27. Use the ``prune`` subcommand to delete all archives except a given number of
  28. *daily*, *weekly*, *monthly* and *yearly* archives::
  29. $ attic prune /somwhere/my-backup.attic --daily=7 --weekly=2 --monthly=6
  30. .. _encrypted_repos:
  31. Repository encryption
  32. ---------------------
  33. Repository encryption is enabled at repository encryption time::
  34. $ attic init --passphrase | --key-file
  35. When repository encryption is enabled all data is encrypted using 256-bit AES_
  36. encryption and the integrity and authenticity is verified using `HMAC-SHA256`_.
  37. |project_name| supports two different methods to derive the AES and HMAC keys.
  38. Passphrase based encryption
  39. This method uses a user supplied passphrase to derive the keys using the
  40. PBKDF2_ key derivation function. This method is convenient to use and
  41. secure as long as a *strong* passphrase is used.
  42. .. Note::
  43. For automated backups the passphrase can be specified using the
  44. `ATTIC_PASSPHRASE` environment variable.
  45. Key file based encryption
  46. This method generates random keys at repository initialization time that
  47. are stored in a password protected file in the ``~/.attic/keys/`` directory.
  48. This method is secure and suitable for automated backups.
  49. .. Note::
  50. The repository data is totally inaccessible without the key file
  51. so it must be kept **safe**.
  52. .. _remote_repos:
  53. Remote repositories
  54. -------------------
  55. |project_name| can initialize and access repositories on remote hosts as the
  56. host is accessible using SSH and |project_name| is installed.
  57. The following syntax is used to address remote repositories::
  58. $ attic init user@hostname:repository.attic
  59. or::
  60. $ attic init ssh://user@hostname:port/repository.attic