From a9d51db68d6ecba8004d25a51eb04703ca56658a Mon Sep 17 00:00:00 2001 From: JL710 Date: Thu, 11 Sep 2025 16:07:50 +0200 Subject: [PATCH] add example for "Pulling a Backup with HTTP over a ssh tunnel" --- doc/080_examples.rst | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/doc/080_examples.rst b/doc/080_examples.rst index a31af5686..4e9a80a5b 100644 --- a/doc/080_examples.rst +++ b/doc/080_examples.rst @@ -353,3 +353,56 @@ system. root@a3e580b6369d:/# sudo -u restic /home/restic/bin/restic --exclude={/dev,/media,/mnt,/proc,/run,/sys,/tmp,/var/tmp} -r /tmp backup / +***************************************************** +Pulling a Backup with HTTP over a ssh tunnel +***************************************************** + +This example will show you how to pull a backup from a remote machine via http over a ssh tunnel. + +Motivation +========== + +If you do a backup like this, you do not need a publicly exposed server where the backup can be stored (like a sftp server). + +A specific use case for this could be a backup of a cloud server (e.g. VPS) to your local PC. + +Running a local restic rest server +================================== + +Install the container image for the `rest server `__: + +.. hint:: you can use podman or docker, both should work + +.. code-block:: console + + docker pull restic/rest-server:latest + +Run container / rest server: + +.. code-block:: console + + docker run --rm -e DISABLE_AUTHENTICATION=0 -p 2555:8000 -v /path/to/local/repo:/data --name restic_rest_server restic/rest-server + +.. note:: ``-p 2555:8000`` maps the ports from the docker container to the host (``host_port:container_port``) + +Create a SSH tunnel to the remote machine +=========================================== + +SSH into the Server with http tunneling: + +.. code-block:: console + + ssh -R 2555:localhost:2555 user@server_ip + + +.. note:: ``-R 2555:localhost:2555`` (``local_port:localhost:remote_port``) specifies remote port forwarding → forwarding connections from the remote machine to the local machine + + +Run restic on the remote machine +================================ + +Then you can use restic through the ssh connection like this + +.. code-block:: console + + restic -r rest:http://localhost:2555/ init