Advertisement
hiro1357

sshtun.service

Jun 20th, 2023 (edited)
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | Source Code | 0 0
  1. [Unit]
  2. Description=SSH Tunnel
  3. After=network-online.target
  4. StartLimitIntervalSec=3610
  5. StartLimitBurst=20
  6.  
  7. [Service]
  8. ExecStart=/usr/bin/screen -Dm -S sshtun /usr/bin/ssh -o ServerAliveInterval=60 -R22222:localhost:22 myuser@myserver "ssh localhost -gL2222:localhost:22222"
  9.  
  10. ExecStop=/usr/bin/screen -S sshtun -X stuff "exit\015"
  11. ExecStop=/usr/bin/screen -wipe
  12.  
  13. WorkingDirectory=/home/myuser
  14. Restart=always
  15. RestartSec=180s
  16. User=myuser
  17. Group=myuser
  18.  
  19. [Install]
  20. WantedBy=multi-user.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement