Skip to content

Instantly share code, notes, and snippets.

@farukuzun
Forked from samos123/reverse-ssh-tunnel.service
Created February 9, 2018 15:56
Show Gist options
  • Select an option

  • Save farukuzun/aafb2869f3ad35505ebd16ba93241f9d to your computer and use it in GitHub Desktop.

Select an option

Save farukuzun/aafb2869f3ad35505ebd16ba93241f9d to your computer and use it in GitHub Desktop.

Revisions

  1. @samos123 samos123 created this gist Jun 27, 2016.
    14 changes: 14 additions & 0 deletions reverse-ssh-tunnel.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    [Unit]
    Description=Phone Home Reverse SSH Service
    ConditionPathExists=|/usr/bin
    After=network.target

    [Service]
    User=sshtunnel
    ExecStart=/usr/bin/ssh -NTC -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -i /home/sshtunnel/.ssh/id_rsa -R 22223:localhost:22 user@remote-ssh-server
    # Restart every >2 seconds to avoid StartLimitInterval failure
    RestartSec=3
    Restart=always

    [Install]
    WantedBy=multi-user.target