Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using upstart to manage a reverse SSH tunnel via autossh. When I do a "sudo start tunnel" the connection comes up just fine; however the command is not being automatically run when the networking services are started, and no matter what I change the "start on" property, I don't seem to be able to get this to run in an automated fashion.

However, like I said, I can start/stop it just fine.

Here's my /etc/init/tunnel.conf, with sensitive stuff stripped out:

description "SSH Tunnel"

start on started networking
stop on stopping networking


env DISPLAY=:0.0

exec autossh -nNT -R 22100:localhost:22 -p 2201
share|improve this question
I guess I don't need the env property, either, that was just left over from the job I copied and modified. – Nuri Hodges Jan 19 '11 at 23:31
up vote 12 down vote accepted

Figured it out, I needed to wait for a specific device, here's my working Upstart job file:

description "SSH Tunnel"

start on (net-device-up IFACE=eth0)
stop on runlevel[016]


env DISPLAY=:0.0

exec autossh -nNT -o ServerAliveInterval=15 -R 22100:localhost:22 -p 2201
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.