hi
i've an ASUS RT-AX53U OpenWrt 23.05.3
i put a command to launch ssh in /etc/rc.local but it is never executed...
/usr/sbin/autossh -M 20000 -i /home/alain/.ssh/id_rsa -N -T -R 2224:10.3.142.1:22 alain@x.x.x.x &
when i launch this command on CLI, it's OK (i don't use autossh daemon for it has never worked...)
do you know why ? if a put another command in /etc/rc.local (like touch) it's OK...
regards
Maybe then network is not yet up when the line is called? Test wktk sleep 10s or something extreme first, the. You can build in something to delay it is that is true. Just a thought.
thanks darkside
i've put sleep 60 and it's the same...
i've put my command in a /etc/init.d script and it's the same...
my init script works when i launch /etc/init.d/launch_ssh start , and my script is in /etc/rc.d (S99launch_ssh)
i dont really understand that weird thing...
i can see in log
Thu Jul 11 16:46:01 2024 daemon.notice procd: /etc/rc.d/S99launch_ssh: start
Thu Jul 11 16:46:01 2024 user.info autossh[3377]: starting ssh (count 1)
Thu Jul 11 16:46:01 2024 user.info autossh[3377]: ssh child pid is 3380
Thu Jul 11 16:46:01 2024 user.err autossh[3377]: ssh exited prematurely with status 1; autossh exiting
thank for this link..
i've tried some tricks...
network interfaces are up before i launch my script...
i've try to redirect error, but there is nothing in the file error.txt... but i think i don't write the right command... is it like that ?
/usr/sbin/autossh -M 0 -i /etc/dropbear/id_rsa -N -T -R 2224:10.3.142.1:22 alain@x.x.x.x & 2> /tmp/error.txt
Does manual SSH to the site work? Dropbear SSH client requires your private key file be in a special format-- you can't just copy it from OpenSSH. The dbconvert utility is used to convert the key.
I don't use autossh so I cannot help but your strategy to get the command to dump output to a log file is a good one. Recommend you first to PoC outside of the startup script just on the shell. Why not capture all output not just errors with a simple:
Yes on CLI the command or the
script works well...
the problem is only when command or script are launch from /etc/rc.local
Doesn't works too when i put command in a init.d script...
thanks all, with your help i've seen why autossh connection failed !
here is the log Host 'x.x.x.x' is not in the trusted hosts file.
(ssh-ed25519 fingerprint SHA256:dcRMA/EpUHW7QjJW3JuuAm/JV9SflKCTFRZFIiX+7X0)
Do you want to continue connecting? (y/n)
/usr/bin/ssh: Connection to alain@x.x.x.x:22 exited: Didn't validate host key
so, i think i need to append local id_rsa key to authorized_keys on the server ? is it right ?
regards