A simple Docker container providing a SSH service and a reverse tunnel port.
docker build -t jimlin7777/ssh-tunneler --no-cache .
id_rsa.pub
) and put it into this folder.create_tunnel.service
into /etc/systemd/system/
.create_tunnel.sh
to meet your need.docker-compose up -d
bash create_tunnel.sh
or systemctl start create_tunnel
(systemctl enable create_tunnel
if you want it to start after booting)ssh -o ExitOnForwardFailure=yes ...
If the client reconnect before the connection has terminated on the server, you can end up in a situation where the new ssh connection is live, but has no port forwardings. In order to avoid that, you need to use the ExitOnForwardFailure keyword on the client side.
$HOME
seems not allowed in ExecStart
.systemctl daemon-reload