I'm attempting to setup a CGI which can connect to a remote system and execute a command.
On the 'client', for the Apache user 'apache' I've give it a shell and generated a key-pair. I've configured Keychain [ http://www.gentoo.org/proj/en/keychain/ ] to load the keys for the apache user and make these persistently available via ssh-agent.
I've setup a specific user 'cgissh' on the remote target system and configured its authorized_keys with apache@client's pubkey.
From the client system, running the following script from the shell returns the information I'd expect...