I am trying to setup autossh to run a tunnel to my VPN server. If I use
autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -R 10000:localhost:22 console@<myvpnip>
it seems to work well and I can use the tunnel.
However, if I add a -f flag to run in the background
autossh -f -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -R 10000:localhost:22 console@<myvpnip>
I get the following when trying to use the tunnel.
Connection refused
What is going on here? Is there a way to log any errors while running it in the background?