Questions tagged [autossh]
35 questions
20
votes
2 answers
Is autossh redundant with systemd?
When creating a persistent reverse SSH tunnel, is autossh useful on a system running systemd? Typically, autossh is run by a service with the option -M set to zero which disables monitoring of the link. This means that ssh has to exit before…
Guy
- 331
- 2
- 7
5
votes
5 answers
Autossh fails on startup
I am trying to make autossh set up a reverse tunnel to a server I have at home automatically with systemd. I set up a unit in /etc/systemd/system called autossh.service
It all works fine if I start the service once I am connected to the Internet.…
Sofía Marlasca Aparicio
- 59
- 1
- 6
4
votes
2 answers
How do I use autossh to set up a no-frills socks proxy?
I use ssh -D 12345 [email protected] to set up dynamic port forwarding via host somewhere.com. I want to switch to using autossh to daemonize the thing and to make sure I don't need to manually monitor it.
I installed the autossh package (on my…
einpoklum
- 8,772
- 19
- 65
- 129
3
votes
2 answers
AutoSSH cannot resolve hostname directly after boot
I want to set up a tunnel to my home server which will be established right after my machine boots. Using this answer, I've got my autossh command set up inside a service, which has been set to run at boot. I want the tunnel to work over the…
Top Cat
- 181
- 6
3
votes
3 answers
Autossh at boot with systemd
I am trying to start a persistent ssh connection at boot with autossh in systemd, following guides such as this one. When I do so, it connects and then immediately disconnects, with very little information in the logs. My system is (uname -a):
Linux…
fifthace
- 133
- 1
- 3
2
votes
1 answer
SSH Tunnel with automatic reconnect and password auth in Docker container
I want to forward a Socks5 proxy using SSH with password authentication inside a Docker container. YES, I know that SSH keys would be better. But since it's not my own server, I'm not able to use keys, they just offer user/password authentication.…
Lion
- 309
- 1
- 4
- 14
2
votes
1 answer
(root) Warning: Identity file /dev/fd/62 not accessible: No such file or directory
Very similar to Failed to open config file '/dev/fd/63', error: No such file or directory for wpa_supplicant except for the fact that I am running as root.
bash-4.4# autossh -v -M 0 -4 -o StrictHostKeyChecking=no -F <(echo…
Elijah Lynn
- 965
- 1
- 11
- 19
2
votes
0 answers
launch reverse tunnel on init with autossh in the background
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"
…
stdcerr
- 2,037
- 12
- 42
- 65
2
votes
0 answers
Automating autossh?
Adding
ControlMaster auto
ControlPath ~/.ssh/sockets/%C
ControlPersist yes
to ~/.ssh/config automatically creates a control connection that stays alive for a long time. This works at home where Internet is stable but not when mobile, changing IPs…
chx
- 850
- 7
- 20
2
votes
0 answers
SSH Remote Port Forward Host Passwordless
I have a Remote Port Forward SSH tunnel from the host1 the host0 at port 10022 through:
$ autossh -R 10022:localhost:22 host0
With host0 record in the ~/.ssh/config file both at host1 and host0:
# host0
Host host0
Hostname host0ddnsip
Port…
Brethlosze
- 247
- 1
- 5
- 17
1
vote
1 answer
Start a service and Run/load a script with ssh or autossh, remote port forwarding in the background "-f" to execute more/next commands in the script!
My config:
debian 10.9
4.19.0-19-amd64
OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d 10 Sep 2019
autossh 1.4g
GNU bash, 5.0.3(1)-release (x86_64-pc-linux-gnu)
I start a service in /etc/systemd/system/myshh.service
ExecStart=/home/user/ssh_run…
Z0OM
- 1
- 4
- 24
- 56
1
vote
1 answer
Autossh options not consistent with what is in its man page?
I have kind of a naive question, but by reading this thread for example: https://superuser.com/questions/37738/how-to-reliably-keep-an-ssh-tunnel-open
One can see in the accepted answer how to use autossh, e.g.:
autossh -M 20000 -f -N…
s.k
- 429
- 1
- 4
- 15
1
vote
1 answer
ssh reverse tunnel works, autossh does not
I have to access an openvpn-vpn server behind a firewall, so to do this I use an ssh-reverse tunnel. While using the "normal" ssh command works, connecting via autossh does not. For all the other connections autossh works fine.
SSH-Command:
ssh -R…
Hermann Straßberger
- 21
- 2
1
vote
0 answers
automatically reset sshfs when it locks up, remount fails unless done manually
i have 2 local dirs on my server mounted on a remote server. Local maintains connections with
autossh -M 23 -R 24:localhost:22 user@server While remote mounts with dirs-sshfs.sh
sshfs -o…
greenvironmentalist
- 11
- 2
1
vote
1 answer
autossh system script fails at boot, works on systemctl restart
I am trying to set up an autossh service to forward ports to a remote server when my monitoring server boots. After some finagling, I got a pretty barebones system script working, with one catch. The service fails to properly start when it is run at…
samh
- 131
- 5