Compare commits

...

4 Commits

Author SHA1 Message Date
Leo R. Lundgren
6d39410958 doc: Reword parts of the text, replace rclone with rest-server
The intent here is to make the text more consistent in its use of different
concepts involved in explaining the idea and setup that is explained, and
to make it easier to follow.

We're also replacing rclone with rest-server, not because we dislike rclone
but in order to keep the text to the basic tooling and the main restic eco-
system.

Finally we also remove the previous tip at the end about keeping the SSH tunnel
up, as it will be during the time the SSH session is running (in which the user
is expected to run the restic commands).
2026-02-18 22:19:56 +01:00
JL710
5c3116901e use rclone for rest server instead of docker 2026-01-17 16:29:26 +01:00
JL710
8943ca15ed apply suggestions from Michael Eischer 2025-09-25 13:35:40 +02:00
JL710
a9d51db68d add example for "Pulling a Backup with HTTP over a ssh tunnel" 2025-09-11 16:07:50 +02:00

View File

@@ -353,3 +353,72 @@ system.
root@a3e580b6369d:/# sudo -u restic /home/restic/bin/restic --exclude={/dev,/media,/mnt,/proc,/run,/sys,/tmp,/var/tmp} -r /tmp backup /
***********************************************************
Back up to an internal repository server over an SSH tunnel
***********************************************************
Idea
====
The idea is to run `REST-server <https://github.com/restic/rest-server>`__ on
an internal host as the repository server and then back up to it from a remote
restic client through a reverse SSH tunnel.
With this approach, you do not need to publicly expose the repository server
to which the backups are sent, as the restic client can instead connect to it
through the SSH tunnel.
An example use case for this method would be to create backups of a server,
e.g. a VPS in the cloud, to a repository stored on your local computer.
Running a local repository server
=================================
On the internal host, download and run the latest `release <https://github.com/restic/rest-server/releases>`__
of REST-server to act as the repository server. In this example we are using
the ``--no-auth`` option to not require authentication when connecting to it:
.. code-block:: console
rest-server --path /path/to/repo --no-auth
.. note:: REST-server by default listens on all network interfaces and port
``8000``.
Creating a reverse SSH tunnel
=============================
On the repository server (the internal host), use ``ssh -R`` to create what's
called a "reverse" SSH tunnel that listens for connections on the *remote* side
and forwards these back through the tunnel to the *local* side:
.. code-block:: console
ssh -R 8000:localhost:8000 user@server
.. note:: In this example, ``localhost`` refers to the local repository server,
and ``server`` refers to the remote system where restic is to be run.
Running restic on the remote system
===================================
Now that the SSH session and tunnel is established, run restic on the remote
system as usual, but with a repository URL that targets that system's side of
the SSH tunnel, in this example ``localhost:8000``.
This will make restic on the remote system connect to port ``8000`` on its
``localhost``, where the SSH tunnel is listening, after which the connection
is forwarded through the tunnel and finally reaches ``localhost:8000`` on the
local side where REST-server is listening and acting as the repository server.
To initialize the repository:
.. code-block:: console
restic -r rest:http://localhost:8000/ init
You can then use standard restic commands such as ``backup``, ``snapshots`` and
``restore`` with the same repository URL and other options as usual.
.. tip:: The tunnel will be active for the duration of the SSH session.