I'm trying to integrate autossh on a raspberry pi.
if I launch the command by itself
autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -N -R 22002:localhost:22 user@myserver
everything works fine, but launching the same command from systemctl
[Unit]
Description=AutoSSH tunnel service Remote port 22002 to local 22
After=network.target
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -N -R 22002:localhost:22 user@myserver.com
[Install]
WantedBy=multi-user.target
returns
Jun 25 13:43:22 pi autossh[995]: Permission denied, please try again.
Jun 25 13:43:22 pi autossh[995]: Permission denied, please try again.
Jun 25 13:43:22 pi autossh[995]: Permission denied (publickey,password).
Jun 25 13:43:22 pi autossh[995]: ssh exited with error status 255; restarting ssh
I am able to ssh my server without password from my pi.
The log in /var/log/auth.log gives me this
Jun 26 13:00:51 localhost sshd[9252]: Connection closed by 178.135.1.253 port 41786 [preauth]
Jun 26 13:00:51 localhost sshd[9254]: Connection closed by 178.135.1.253 port 41788 [preauth]
Jun 26 13:00:51 localhost sshd[9256]: Connection closed by 178.135.1.253 port 41790 [preauth]
Jun 26 13:00:51 localhost sshd[9258]: Connection closed by 178.135.1.253 port 41792 [preauth]
Jun 26 13:00:52 localhost sshd[9260]: Connection closed by 178.135.1.253 port 41794 [preauth]
Jun 26 13:00:52 localhost sshd[9262]: Connection closed by 178.135.1.253 port 41796 [preauth]
Jun 26 13:00:54 localhost sshd[9264]: Connection closed by 178.135.1.253 port 41798 [preauth]
Jun 26 13:01:03 localhost sshd[9267]: Connection closed by 178.135.1.253 port 41802 [preauth]
Jun 26 13:01:05 localhost sshd[9269]: Connection closed by 178.135.1.253 port 41804 [preauth]
anything i should check up or do ?
Thanks,