Reply to Re: [PHP] Re: run remote shell script

Your name:

Reply:


Posted by Roger Thomas on 08/18/05 07:50

OK. I am able to setup remote key authentication between svrA and svrB. From svrA I can login to svrB with something like
[www@svrA www]$ ssh www@svrB

and I can also execute a shell script like
[www@svrA www]$ ssh www@svrB /tmp/test.sh

On svrA I have a PHP script like so:
<?
system('ssh www@svrB /tmp/test.sh someDIR');
?>

/tmp/test.sh on svrB is only a one liner like so:
mkdir /tmp/$1

I ran the script from the browser but the /tmp/someDIR is not created :(
Could it be that user nobody on svrA is *not* allowed to connect to svrB because the public key belongs to user www ? How do I rectify this ?

In the actual situation, I need to execute a shell script in svrB (from browser served by Apache on svrA) that only root can run. Please advise. I am getting very worried.

--
Roger



Quoting Matthew Weier O'Phinney <mweierophinney@gmail.com>:

> * Roger Thomas <sniper@home.net.my>:
> > My PHP script is in svrA. How do I run a shell script in svrB?
> > svrB does not have PHP and Apache :(
> > Is this at all possible? Please advise.
>
> Use ssh. You will have to setup remote key authentication from svrA to
> svrB (so that a password will not be needed), and then in your script
> you would call:
>
> system('ssh svrB /path/to/scriptToRun');
>
> --
> Matthew Weier O'Phinney
> Zend Certified Engineer
> http://weierophinney.net/matthew/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>





---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация