I started looking at the possibility of making some of our bash scripts available through a web server using CGI and the simple ones works just fine. Now I need to execute remote commands using ssh but can't really get it to work. I got private keys all sorted. Must be ssh having issues handling stdin/stdout. Please any advise will be highly appreciated.
I suggest you create debugging output of your script, like this:
#!/bin/bash
function _debug { echo "$1" >>/tmp/yourlogfile.txt ; }
_debug "trying to run command ..."
some_command 2>>/tmp/yourlogfile.xt
The expected problem is that the environment of the webserver, where your script runs is different from your testing environment, which supposedly is a normal system user.