Created
January 9, 2018 14:32
-
-
Save uchm4n/86ba74ed82b2658cbbd26590a1bdd57b to your computer and use it in GitHub Desktop.
Revisions
-
uchm4n created this gist
Jan 9, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ # Ubuntu 15.04+ [Unit] Description=Setup a secure tunnel to server Wants=network-online.target After=network-online.target [Service] User=admin Environment="LOCAL_ADDR=localhost" ExecStart=/usr/bin/autossh -M 0 -N -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -R *:19871:localhost:22 root@server -p 22 -X RestartSec=60 Restart=always [Install] WantedBy=multi-user.target # After that you can enter in remote server and execute folowing: ssh root@localhost -p 19871