I have a script that uses ssh to connect to a remote server. It works fine when run from command line as root.
When it is run from a late stage START=99 /etc/init.d task, the ssh fails because the remote server does not match a known host.
Does the /etc/init.d task run as root by default? I do not see in the docs where it specifies this.
As a temporary work around I have copied the contents of /root/.ssh/known_hosts to /.ssh/known_hosts and it seems to function. This suggests either that the /etc/init.d task is running as a different user or there is a problem in dropbear when used at that time.
It looks like the problem in in OpenWRT since the following are not set before running init.d scripts
USER='root'
LOGNAME='root'
Thus the home directory is also not set.