launch reverse tunnel with autossh on bootup in Ubuntu
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I would like to launch a ssh reverse tunnel on system launch.
The following line let's me establish the tunnel fine - but I end up being logged into server
which I don't want, especially not from an init script.
/usr/bin/autossh -M 22222 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /path/to/my/key.key -R 9999:localhost:22 ubuntu@server
man autossh
says that the -f
option should do what I need:
causes autossh to drop to the background before running ssh.
but the problem is, it doesn't seem to work when I change my command to usr/bin/autossh -f -M...
. I've tried this out as part of my init script too which looks like:
#! /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 /work/cloudparc/docs/EtherWan/etherwan.key -R 9999:localhost:22 ubuntu@cloudtunnel.hopto.org
;;
stop)
echo -n "Shutting down utossk"
/usr/bin/killall -KILL autossh
;;
*)
echo "Usage: $0 stop"
exit 1
esac
exit 0
But I need an option to throw it in the background, how do I do this if the -f option doesn't work for me?
ssh-tunneling background-process init-script autossh
add a comment |Â
up vote
0
down vote
favorite
I would like to launch a ssh reverse tunnel on system launch.
The following line let's me establish the tunnel fine - but I end up being logged into server
which I don't want, especially not from an init script.
/usr/bin/autossh -M 22222 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /path/to/my/key.key -R 9999:localhost:22 ubuntu@server
man autossh
says that the -f
option should do what I need:
causes autossh to drop to the background before running ssh.
but the problem is, it doesn't seem to work when I change my command to usr/bin/autossh -f -M...
. I've tried this out as part of my init script too which looks like:
#! /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 /work/cloudparc/docs/EtherWan/etherwan.key -R 9999:localhost:22 ubuntu@cloudtunnel.hopto.org
;;
stop)
echo -n "Shutting down utossk"
/usr/bin/killall -KILL autossh
;;
*)
echo "Usage: $0 stop"
exit 1
esac
exit 0
But I need an option to throw it in the background, how do I do this if the -f option doesn't work for me?
ssh-tunneling background-process init-script autossh
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I would like to launch a ssh reverse tunnel on system launch.
The following line let's me establish the tunnel fine - but I end up being logged into server
which I don't want, especially not from an init script.
/usr/bin/autossh -M 22222 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /path/to/my/key.key -R 9999:localhost:22 ubuntu@server
man autossh
says that the -f
option should do what I need:
causes autossh to drop to the background before running ssh.
but the problem is, it doesn't seem to work when I change my command to usr/bin/autossh -f -M...
. I've tried this out as part of my init script too which looks like:
#! /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 /work/cloudparc/docs/EtherWan/etherwan.key -R 9999:localhost:22 ubuntu@cloudtunnel.hopto.org
;;
stop)
echo -n "Shutting down utossk"
/usr/bin/killall -KILL autossh
;;
*)
echo "Usage: $0 stop"
exit 1
esac
exit 0
But I need an option to throw it in the background, how do I do this if the -f option doesn't work for me?
ssh-tunneling background-process init-script autossh
I would like to launch a ssh reverse tunnel on system launch.
The following line let's me establish the tunnel fine - but I end up being logged into server
which I don't want, especially not from an init script.
/usr/bin/autossh -M 22222 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /path/to/my/key.key -R 9999:localhost:22 ubuntu@server
man autossh
says that the -f
option should do what I need:
causes autossh to drop to the background before running ssh.
but the problem is, it doesn't seem to work when I change my command to usr/bin/autossh -f -M...
. I've tried this out as part of my init script too which looks like:
#! /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 /work/cloudparc/docs/EtherWan/etherwan.key -R 9999:localhost:22 ubuntu@cloudtunnel.hopto.org
;;
stop)
echo -n "Shutting down utossk"
/usr/bin/killall -KILL autossh
;;
*)
echo "Usage: $0 stop"
exit 1
esac
exit 0
But I need an option to throw it in the background, how do I do this if the -f option doesn't work for me?
ssh-tunneling background-process init-script autossh
ssh-tunneling background-process init-script autossh
asked 11 mins ago
cerr
67282239
67282239
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%2f479653%2flaunch-reverse-tunnel-with-autossh-on-bootup-in-ubuntu%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