serve.rst 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. .. include:: serve.rst.inc
  2. Examples
  3. ~~~~~~~~
  4. borg serve has special support for ssh forced commands (see ``authorized_keys``
  5. example below): it will detect that you use such a forced command and extract
  6. the value of the ``--restrict-to-path`` option(s).
  7. It will then parse the original command that came from the client, makes sure
  8. that it is also ``borg serve`` and enforce path restriction(s) as given by the
  9. forced command. That way, other options given by the client (like ``--info`` or
  10. ``--umask``) are preserved (and are not fixed by the forced command).
  11. Environment variables (such as BORG_HOSTNAME_IS_UNIQUE) contained in the original
  12. command sent by the client are *not* interpreted, but ignored. If BORG_XXX environment
  13. variables should be set on the ``borg serve`` side, then these must be set in system-specific
  14. locations like ``/etc/environment`` or in the forced command itself (example below).
  15. ::
  16. # Allow an SSH keypair to only run borg, and only have access to /path/to/repo.
  17. # Use key options to disable unneeded and potentially dangerous SSH functionality.
  18. # This will help to secure an automated remote backup system.
  19. $ cat ~/.ssh/authorized_keys
  20. command="borg serve --restrict-to-path /path/to/repo",no-pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc ssh-rsa AAAAB3[...]
  21. # Set a BORG_XXX environment variable on the "borg serve" side
  22. $ cat ~/.ssh/authorized_keys
  23. command="export BORG_XXX=value; borg serve [...]",restrict ssh-rsa [...]