Created
October 16, 2022 00:55
-
-
Save Tugzrida/cbe56f17a373254f28bfc6541af21de3 to your computer and use it in GitHub Desktop.
Persistent SSH connection for remote access
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 characters
[Unit] | |
Description=Remote access to local ssh daemon | |
After=network.target | |
[Service] | |
Environment="AUTOSSH_GATETIME=0" | |
Environment="AUTOSSH_PORT=0" | |
ExecStart=/usr/bin/autossh -o ServerAliveInterval=60 -o ServerAliveCountMax=2 -i /path/to/key -o ExitOnForwardFailure=yes -o VerifyHostKeyDNS=yes -N -R jumpbox_port:127.0.0.1:22 user@jumpbox | |
Restart=always | |
RestartSec=10 | |
[Install] | |
WantedBy=multi-user.target |
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 characters
Host remote_device | |
User user | |
ProxyCommand ssh -W 127.0.0.1:jumpbox_port jumpbox |
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 characters
ClientAliveInterval 60 | |
ClientAliveCountMax 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment