Ssh tunnel : permission denied

After modifying legato.cwe our application is added successfully to the list, but we still can’t create the SSH tunnel from within it. I’m not sure if there’s something in the way we’re using the system function call which is the issue, but it’s just:

system(“ssh -p 12345 -R 23456:localhost:22 sshtest@oururl.com -i /home/root/.ssh/id_rsa”);

The same command works fine when issued manually from the Linux shell. And when we disable SMACK we lose all internet connectivity (though the USB connection still works), so that’s a dead end too and we’re still stumped.

So we’ve tried another route, which is to add the SSH command to a script that’s run from startlegato.sh. The script runs a loop that looks for the presence of a file in a specific directory which is written to by our application, if it finds the file it runs the same SSH command and then deletes the file. This doesn’t work either, the file is being removed so the script is running, but the SSH tunnel is still not created.

Any reason why this automated script method isn’t working? There’s nothing written to any log that I can find or useful information using dmesg. We’ve redirected the script output to a file and there’s no information there either.

Thanks