Re: Running system commands

From: Date: Thu, 25 Sep 2003 12:49:47 +0000
Subject: Re: Running system commands
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-163888@lists.php.net to get a copy of this message
It was filtering, but now I've opened the port to listen to my machine, which is running my web server (where all php scripts qre running). So, that's not a problem now. I've checked it (SSH) on the terminal, it's working fine with root as well as other users. Now, problem is, for other users it asks for password, which i dont want to surpass. Your idea of running encrypted tunnel to use telnet services is good, but i cann't use it, cause i've blocked that port, and i dont want to open it. Second thing is, yes I'm using system() for command from php and it's not showing any result. May be you r right that, it's just sitting waiting for password. If, you've any idea to deal with it, please let me know. Anyway, thanks a lot for your time and great help. Nitin ----- Original Message ----- From: "Evan Nemerson" <evan@coeus-group.com> To: "Nitin" <nitinmehta@kappa.net.in> Sent: Thursday, September 25, 2003 4:38 PM Subject: Re: [PHP] Running system commands > If it's filtering port 22, you're not going to be able to access the server > from any client, unless you can bypass the firewall. > > Only the server needs to be run as root. The client should _never_ be run as > root. > > I don't know how to pass the password as an argument (and honestly hope there > isn't one). Furthermore, the client will probably open the terminal to accept > input instead of relying on stdin, so I doubt you can send the password via > stdin. > > What I think you'll probably end up doing is creating an encrypted tunnel via > SSH to a telnet server. Search for how to use port forwarding with whatever > ssh software you're using, and learn the interface. > > Run the same command from a shell as you're running from PHP. Is there any > output? What method for execution are you using (backtick, exec, system, > passthru, etc)? It's also entirely possible that ssh is siting there waiting > for a password you can't input because it's not a true terminal. > > > > > On Thursday 25 September 2003 03:20 am, you wrote: > > Yeah, I did it with ipchains, it was blocking that particular port, that's > > fine. > > But how do I do all this functioning from within PHP. I mean, if I want to > > use ssh not with root, what should I do? > > Explain it if you can. How'll I give my password and do other functionning? > > and one more thing, it doesn't show any output on executing ssh from within > > php, now how do i know that it's working or not? > > > > I'm really thankful to you, for all your help. > > > > Nitin > > > > ----- Original Message ----- > > From: "Evan Nemerson" <evan@coeus-group.com> > > To: "Nitin" <nitinmehta@kappa.net.in> > > Sent: Thursday, September 25, 2003 11:38 AM > > Subject: Re: [PHP] Running system commands > > > > > ipchains -L will show your firewall. > > > if that doesn't work, you might want to try iptables -L... ipchains is > > > obsolete. > > > What does netstat -lp show for port 22/ssh? > > > What does a portscan show? > > > > > > On Wednesday 24 September 2003 11:03 pm, you wrote: > > > > No problem starting it. When I connect with ssh, it says: > > > > > > > > Connect: connection to hostname on port 22 refused. > > > > > > > > And, same problem with root as well as others. > > > > Do you have any idea, where does ipchains store all the rules Accepting > > > > and > > > > > > Rejecting packets? > > > > > > > > Thanks for the help. > > > > Nitin > > > > > > > > > > > > ----- Original Message ----- > > > > From: "Evan Nemerson" <evan@coeus-group.com> > > > > To: "Nitin" <nitinmehta@kappa.net.in> > > > > Sent: Thursday, September 25, 2003 4:45 AM > > > > Subject: Re: [PHP] Running system commands > > > > > > > > > What exactly is the problem? What does the sshd say when you try to > > > > start > > > > > > > it? Are you running as root (which you must be for it to run on port > > > > 22, > > > > > > > which is default)? > > > > > > > > > > On Wednesday 24 September 2003 04:51 am, you wrote: > > > > > > Thanks for the help, I'v configured ssh, but there seems to be some > > > > > > problem with particular port. Thanx anyway > > > > > > > > > > > > Nitin > > > > > > > > > > > > ----- Original Message ----- > > > > > > From: "Evan Nemerson" <evan@coeus-group.com> > > > > > > To: "Nitin" <nitinmehta@kappa.net.in>; <php-general@lists.php.net> > > > > > > Sent: Tuesday, September 23, 2003 4:44 PM > > > > > > Subject: Re: [PHP] Running system commands > > > > > > > > > > > > > google for openssh or lsh. I dunno if you'd be able to input the > > > > > > > password through PHP, but if not you could telnet over an SSH > > > > > > > encrypted tunnel... > > > > > > > > > > > > Or > > > > > > > > > > > > > if you have absolutely no worries about security you could use > > > > > > > telnet, but that would be, IMHO, a Bad Idea(TM). > > > > > > > > > > > > > > On Tuesday 23 September 2003 02:06 am, Nitin wrote: > > > > > > > > Hi all, > > > > > > > > > > > > > > > > I was wondering, if anyone can help me with running system > > > > commands > > > > > > > > > > from within php. Actually I have a script which deletes users > > > > from > > > > > > > > > > my > > > > > > > > > > > > database > > > > > > > > > > > > > > (which is of course MySQL), now I want to delete those users > > > > from > > > > > > > > > > system level also, as they are authenticated users of my OS > > > > also. > > > > > > > > > > Now, the problem is, that I'm running my MySQL server > > > > > > > > and web > > > > > > > > server on different machines. I can do whatever on remote DB > > > > server > > > > > > > > > > but how to run > > > > > > > > > > > > a > > > > > > > > > > > > > > system command on another machine. I know, it's > > > > > > > > possible to run > > > > > > > > system commands on local server by system(), but what about > > > > remote > > > > > > > > > > server? > > > > > > > > > > > > > > > > Any help will be highly appreciated. > > > > > > > > > > > > > > > > Thanx in advance > > > > > > > > Nitin > > > > > > > > > > > > > > -- > > > > > > > "Who controls the past controls the future. Who controls the > > > > present > > > > > > > > controls > > > > > > > > > > > > > the past." > > > > > > > > > > > > > > -George Orwell > > > > > > > > > > > > > > -- > > > > > > > PHP General Mailing List (http://www.php.net/) > > > > > > > To unsubscribe, visit: > > > > > > > http://www.php.net/unsub.php > > > > > > > > > > -- > > > > > [cli] > > > > > "To think is to differ." > > > > > > > > > > -Clarence Darrow > > > > > > -- > > > [cli] > > > "If you would be a real seeker after truth, you must at least once in > > > your life doubt, as far as possible, all things." > > > > > > -Rene Descartes > > -- > "A leader is the wave pushed ahead by the ship." > > -Leo Nikolaevich Tolstoy

« previous php.general (#163888) next »