I have an upstart job /etc/init/tunnel.conf
:
description "SSH Tunnel"
start on (net-device-up IFACE=eth0)
stop on runlevel[016]
respawn
exec autossh -nNT -o ServerAliveInterval=15 -R 12345:localhost:22 myuser@myserver
When I look at the /var/log/upstart/tunnel.log
:
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-with-mic,password).
but if I try from terminal
autossh -R 12345:localhost:22 myuser@myserver
It connects to myserver without asking me for password (I have copied the SSH keys)
When I run it using sudo
:
sudo autossh -R 12345:localhost:22 myuser@myserver
It asks me for myserver password, so I guess this is the problem I have with the upstart job. Why SSH is asking me for password we I run it as a root?