Re: [PHP] run a command on a remote host
Hi Brad, Thanks for your help, I'm trying to run this code to know which user is running my webserver. I think it is the nobody #!/usr/local/bin/php -q HTML BODY bgcolor='#ff' ?php echo PRE; #$output=passthru(rsh rubella ls /tmp/salididta.txt,$vari); $output=system(who am I,$vari); echo salida.$vari; printf(\nPRE%s/PRE\n,$output); ? /BODY /HTML but I only get this salida0 and I don't get the user How can I know the user? so I can give it permisions to run a rsh? I check and I only can do a rsh to that machine if I'm login with my user and the user root, but I don't know the user of the web server. --- Brad Lhotsky [EMAIL PROTECTED] wrote: Don't forget that this will be executed as the user that the webserver is running as. Hopefully that's not root in this case. Check out the docs for rsh, you can specify the username with the -l option. I don't know if that will accomplish what you want. Also, what do you mean by nothing happen. No output to the browser? The command does not execute? What error messages are in your webserver's error_log? I'm not incredibly well versed in rsh, but you couls potentially run into some issues with the -l option too. Check your error_log though, if it doesn't spell out what's wrong to you, it should atleast give some information that someone here might be able to expand on. On Tue, Dec 09, 2003 at 02:44:28PM -0800, Ivone Uribe wrote: How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brad Lhotsky [EMAIL PROTECTED] __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] run a command on a remote host
Thanks Vail and all! I use it: rsh -l user host command and and I can run it! Kisses! --- Vail, Warren [EMAIL PROTECTED] wrote: Well, it is not possible directly, but you can try some of the following; $cmd = rsh -l user host command;// remote shell $cmd = rpc -l user host command;// remote procedure call $cmd = rexec -l user host command; // remote exec $cmd = ssh host command;// secure shell (recommended, but not always available) exec($cmd, $returnlines); // your php command for one of the above foreach($returnlines as $line) echo $line.br; // output results I haven't checked the syntax of the various commands, but I think this answers your question about a few options that might be available. rsh, rexec, rpc and ssh are defined best in Unix references, but many are also available if your php server is windows based. good luck, Warren Vail -Original Message- From: Nathan Taylor [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 3:48 PM To: [EMAIL PROTECTED]; Ivone Uribe Subject: Re: [PHP] run a command on a remote host When you say remote host do you mean the server executing the script or the person accessing it? If you mean the latter, it is not possible. - Original Message - From: Ivone Uribe To: [EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 5:44 PM Subject: [PHP] run a command on a remote host How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] run a command on a remote host
When you say remote host do you mean the server executing the script or the person accessing it? If you mean the latter, it is not possible. - Original Message - From: Ivone Uribe To: [EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 5:44 PM Subject: [PHP] run a command on a remote host How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] run a command on a remote host
Don't forget that this will be executed as the user that the webserver is running as. Hopefully that's not root in this case. Check out the docs for rsh, you can specify the username with the -l option. I don't know if that will accomplish what you want. Also, what do you mean by nothing happen. No output to the browser? The command does not execute? What error messages are in your webserver's error_log? I'm not incredibly well versed in rsh, but you couls potentially run into some issues with the -l option too. Check your error_log though, if it doesn't spell out what's wrong to you, it should atleast give some information that someone here might be able to expand on. On Tue, Dec 09, 2003 at 02:44:28PM -0800, Ivone Uribe wrote: How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brad Lhotsky [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] run a command on a remote host
Well, it is not possible directly, but you can try some of the following; $cmd = rsh -l user host command; // remote shell $cmd = rpc -l user host command; // remote procedure call $cmd = rexec -l user host command; // remote exec $cmd = ssh host command; // secure shell (recommended, but not always available) exec($cmd, $returnlines); // your php command for one of the above foreach($returnlines as $line) echo $line.br; // output results I haven't checked the syntax of the various commands, but I think this answers your question about a few options that might be available. rsh, rexec, rpc and ssh are defined best in Unix references, but many are also available if your php server is windows based. good luck, Warren Vail -Original Message- From: Nathan Taylor [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 3:48 PM To: [EMAIL PROTECTED]; Ivone Uribe Subject: Re: [PHP] run a command on a remote host When you say remote host do you mean the server executing the script or the person accessing it? If you mean the latter, it is not possible. - Original Message - From: Ivone Uribe To: [EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 5:44 PM Subject: [PHP] run a command on a remote host How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru(rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php