How to configure a reverse tunnel for SSH?

How to configure a reverse tunnel for SSH?

1 – Create a service for each reverse tunnel you want to set up, and give it a meaningful name. This is a ‘Systemd Object’, a service in this case, as it will be used to start/stop/restart/reload a specific daemon or service like Apache or like in this case an ssh reverse tunnel.

How to create a secure tunnel in systemd?

Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name of target host: We need a configuration file (inside /etc/default) for each target host we will be creating tunnels for.

How to create a tunnel to a host?

The template parameter will correspond to the name of target host: We need a configuration file (inside /etc/default) for each target host we will be creating tunnels for. For example, let’s assume we want to tunnel to a host named jupiter (probably aliased in /etc/hosts ).

How to create a secure tunnel in Jupiter?

Create the file at /etc/default/secure-tunnel@jupiter: Note that for the above to work we need to have allready setup a password-less SSH login to target (e.g. by giving access to a non-protected private key). Or enable it, so it get’s started at boot time:

How to set up auto SSH with systemd?

The “ServerAliveInterval 60” ensures that every 60 seconds a null packet is sent to keep the connection alive. The “ServerAliveCountMax 3” set to three the number of server alive messages that may be sent without getting a reply. The “-p 22” is the port that the remote ssh server is listening on (ssh usually is at port 22).

Is there a way to reverse tunnel autossh?

Autossh can establish a reverse tunnel from their network to your network and you can just use any of the myriad of network sync tools to accomplish your off-site backup. Before we begin we need to make the following assumptions. Autossh will be running in a computer named “autossh_server” on a different network.