Re: Re: PHP hangs when exec'ing SSH
| From: | Ross Becker | Date: | Thu, 10 Mar 2005 20:28:03 +0000 |
| Subject: | Re: Re: PHP hangs when exec'ing SSH | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-210466@lists.php.net to get a copy of this message | ||
Richard,
I'm really not sure what you're asking here. I've created a limited access user account on a remote host so that I can kick off some things on the remote host by hitting a web page. Access to the web page is protected via SSL and user authentication. The things which are executed on the remote host are special purpose programs I am building, not general commands, and no place does the web page provide a user direct control over what programs are run.
"su" was only used by me from the command-line to become the same user the web-server runs under in order that I would get the same public/private key authentication under SSH as I do when the script runs as a web page. It is not involved in what the php code runs. Take a look at the bug report to see a completely reduced test-case which reproduces the problem I'm seeing.
--Ross
Richard Lynch wrote:
I actually do care about the return code from the program, as well as knowing that the program executed and completed successfully, so background execution is not a valid option. I tried using system("ssh user@host mycommand > /dev/null 2>&1") and got the same results. You are correct that I am using "su" to become the same user that the web server runs under, after temporarily changing the password file to give said user a valid shell. I can verify that the shell does not affect whether this problem occurs or not, and I have determined that the SSH process is not left lying around after it executes- The remote command is run, ssh executes, PHP simply never comes back. Bug link is here: http://bugs.php.net/bug.php?id=22946 At this point I'd love to hear from anyone running a different version of PHP, OS, or Apache who can actually execute this to find out if they experience results which are the same or different.I believe 'su' requires an actual TTY connection or it aborts... Could be wrong. "man su" Why are you doing ssh anyway? scp, maybe, but... Sure you're not taking web-based user into and then doing SSH to execute it on a different server?... [shudder]