launch reverse tunnel on init with autossh in the background`
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I need an init script which will establish a reverse tunnel connection to a server. I've come up with the following start script:
#! /bin/sh
### BEGIN INIT INFO
### END INIT INFO
case "$1" in
start)
echo "Starting autossh"
/usr/bin/autossh -M 22222 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /path/to/my.key -R 9999:localhost:22 ubuntu@host
;;
stop)
echo -n "Shutting down autossh"
/usr/bin/killall -KILL autossh
;;
*)
echo "Usage: $0 start"
exit 1
esac
exit 0
Which has one problem: It doesn't launch the process in the background, otherwise it works as expected. I have attempted to use the -f
flag and altered the start)
line to /usr/bin/autossh -f -M 22222
but that does not seem to work and I'm wondering why. What am I doing wrong, the man page says
-f' causes autossh to drop to the background before running ssh.
Which is what I need, is it not? Can anyone help me further?
ssh-tunneling init-script autossh
add a comment |Â
up vote
1
down vote
favorite
I need an init script which will establish a reverse tunnel connection to a server. I've come up with the following start script:
#! /bin/sh
### BEGIN INIT INFO
### END INIT INFO
case "$1" in
start)
echo "Starting autossh"
/usr/bin/autossh -M 22222 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /path/to/my.key -R 9999:localhost:22 ubuntu@host
;;
stop)
echo -n "Shutting down autossh"
/usr/bin/killall -KILL autossh
;;
*)
echo "Usage: $0 start"
exit 1
esac
exit 0
Which has one problem: It doesn't launch the process in the background, otherwise it works as expected. I have attempted to use the -f
flag and altered the start)
line to /usr/bin/autossh -f -M 22222
but that does not seem to work and I'm wondering why. What am I doing wrong, the man page says
-f' causes autossh to drop to the background before running ssh.
Which is what I need, is it not? Can anyone help me further?
ssh-tunneling init-script autossh
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I need an init script which will establish a reverse tunnel connection to a server. I've come up with the following start script:
#! /bin/sh
### BEGIN INIT INFO
### END INIT INFO
case "$1" in
start)
echo "Starting autossh"
/usr/bin/autossh -M 22222 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /path/to/my.key -R 9999:localhost:22 ubuntu@host
;;
stop)
echo -n "Shutting down autossh"
/usr/bin/killall -KILL autossh
;;
*)
echo "Usage: $0 start"
exit 1
esac
exit 0
Which has one problem: It doesn't launch the process in the background, otherwise it works as expected. I have attempted to use the -f
flag and altered the start)
line to /usr/bin/autossh -f -M 22222
but that does not seem to work and I'm wondering why. What am I doing wrong, the man page says
-f' causes autossh to drop to the background before running ssh.
Which is what I need, is it not? Can anyone help me further?
ssh-tunneling init-script autossh
I need an init script which will establish a reverse tunnel connection to a server. I've come up with the following start script:
#! /bin/sh
### BEGIN INIT INFO
### END INIT INFO
case "$1" in
start)
echo "Starting autossh"
/usr/bin/autossh -M 22222 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /path/to/my.key -R 9999:localhost:22 ubuntu@host
;;
stop)
echo -n "Shutting down autossh"
/usr/bin/killall -KILL autossh
;;
*)
echo "Usage: $0 start"
exit 1
esac
exit 0
Which has one problem: It doesn't launch the process in the background, otherwise it works as expected. I have attempted to use the -f
flag and altered the start)
line to /usr/bin/autossh -f -M 22222
but that does not seem to work and I'm wondering why. What am I doing wrong, the man page says
-f' causes autossh to drop to the background before running ssh.
Which is what I need, is it not? Can anyone help me further?
ssh-tunneling init-script autossh
ssh-tunneling init-script autossh
asked 10 mins ago
cerr
68282239
68282239
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479658%2flaunch-reverse-tunnel-on-init-with-autossh-in-the-background%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password