mirror of
https://github.com/restic/restic.git
synced 2026-07-18 21:24:53 +00:00
add example for "Pulling a Backup with HTTP over a ssh tunnel"
This commit is contained in:
@@ -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 <https://github.com/restic/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
|
||||
|
||||
Reference in New Issue
Block a user