in reply to SSH::Expect on Webpage

I ran into the same problem a couple weeks ago.

What worked fine on httpd running under Ubuntu 8.04 did not work at all under Fedora Core 8. Had to do with the httpd/daemon user using a different shell (sh vs bash), different user permissions, different TTY settings, etc, etc, etc.

My solution will be to use a daemonized Perl script running under a user account that will take care of the SSH behavior, while the CGI (or actually mod_perl2 in this case) portion just interacts with the daemon through a "queue" (in a MySQL database table).

I've used this pattern in the past for other reasons, and it has generally worked out very well. It also scales out a bit better too, since I could conceivably have multiple daemons running on different servers, each working from the same queue, leaving the httpd server to simply process web requests, instead of dealing with remote servers as well.