Re: [PHP] Running system commands

2003-09-25 Thread Nitin
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 [EMAIL PROTECTED]
To: Nitin [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
  To: Nitin [EMAIL PROTECTED]
  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 [EMAIL PROTECTED]
To: Nitin [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
  To: Nitin [EMAIL PROTECTED];
[EMAIL PROTECTED]
  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

Re: [PHP] Running system commands

2003-09-24 Thread Nitin
Thanks for your help, I'v configured ssh, though it's running fine, I'm not
able to connect to my server, it says-

connect: connection to host on port 22 refused.

i think this is due to, some firewall. I'll check it out.
in the mean time can you clearify what are verbatim commands!!!

Thnaks for your help anyway
Nitin

- Original Message - 
From: Robert Cummings [EMAIL PROTECTED]
To: Mike Migurski [EMAIL PROTECTED]
Cc: Nitin [EMAIL PROTECTED]; PHP-General
[EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 2:16 AM
Subject: Re: [PHP] Running system commands


 On Tue, 2003-09-23 at 16:34, Mike Migurski wrote:
  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?
 
  This is partially dependent on the user your php scripts are running as.
  One approach might be to use SSH to talk to the remote machine, and set
up
  a limited-privilege account there. You can run a copy of ssh-agent[1] as
  the apache user, which stores an open copy of a private SSH key in
memory,
  add the public half of that key to the remote machine's authorized_keys
  file[2], and use SSH to access that machine.

 Alternatively you could have a simple little PHP daemon on the webserver
 and it could check a table in the remote DB every minute or so for
 verbatim commands to execute. Depends really on whether these commands
 need to occur real time or not.

 Cheers,
 Rob.
 -- 
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Running system commands

2003-09-23 Thread Nitin
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

Re: [PHP] Running system commands

2003-09-23 Thread Evan Nemerson
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



Re: [PHP] Running system commands

2003-09-23 Thread Mike Migurski
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?

This is partially dependent on the user your php scripts are running as.
One approach might be to use SSH to talk to the remote machine, and set up
a limited-privilege account there. You can run a copy of ssh-agent[1] as
the apache user, which stores an open copy of a private SSH key in memory,
add the public half of that key to the remote machine's authorized_keys
file[2], and use SSH to access that machine.

[1] http://www.phil.uu.nl/~xges/ssh/
[2] http://www.nevis.columbia.edu/cgi-bin/man.sh?man=ssh

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running system commands

2003-09-23 Thread Robert Cummings
On Tue, 2003-09-23 at 16:34, Mike Migurski wrote:
 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?
 
 This is partially dependent on the user your php scripts are running as.
 One approach might be to use SSH to talk to the remote machine, and set up
 a limited-privilege account there. You can run a copy of ssh-agent[1] as
 the apache user, which stores an open copy of a private SSH key in memory,
 add the public half of that key to the remote machine's authorized_keys
 file[2], and use SSH to access that machine.

Alternatively you could have a simple little PHP daemon on the webserver
and it could check a table in the remote DB every minute or so for
verbatim commands to execute. Depends really on whether these commands
need to occur real time or not.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running system commands

2003-02-26 Thread Chris Hewitt
[EMAIL PROTECTED] wrote:

I was thinking the exact same thing but I can actually delete files from
these directories using a system command through php. Would that be a
different type of permission?
Ed

On Tue, 25 Feb 2003, Chris Hewitt wrote:

[EMAIL PROTECTED] wrote:

Before I ask, I have read the documentation but nothing seems to work.

I want to run a system command from behind the scenes (totally secure
area of my server) that creates a directory and changes permissions on it.
i.e. system (mkdir $path);

Example above uses a value from a form passed to the script and is
assigned from $_POST['path'];
When I run it no directory is created. Ideas??

Does the user that the webserver is running as have permissions to make 
that directory?

HTH
Chris
No, it would be the same permissions.

Regards

Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Running system commands

2003-02-25 Thread ed

 Before I ask, I have read the documentation but nothing seems to work.

 I want to run a system command from behind the scenes (totally secure
area of my server) that creates a directory and changes permissions on it.

i.e. system (mkdir $path);

 Example above uses a value from a form passed to the script and is
assigned from $_POST['path'];

 When I run it no directory is created. Ideas??

Thanks,

Ed
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running system commands

2003-02-25 Thread Chris Hewitt
[EMAIL PROTECTED] wrote:

Before I ask, I have read the documentation but nothing seems to work.

I want to run a system command from behind the scenes (totally secure
area of my server) that creates a directory and changes permissions on it.
i.e. system (mkdir $path);

Example above uses a value from a form passed to the script and is
assigned from $_POST['path'];
When I run it no directory is created. Ideas??

Does the user that the webserver is running as have permissions to make 
that directory?

HTH
Chris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Running system commands

2003-02-25 Thread Jason Wong
On Wednesday 26 February 2003 03:28, [EMAIL PROTECTED] wrote:
  Before I ask, I have read the documentation but nothing seems to work.

  I want to run a system command from behind the scenes (totally secure
 area of my server) that creates a directory and changes permissions on it.

 i.e. system (mkdir $path);

  Example above uses a value from a form passed to the script and is
 assigned from $_POST['path'];

  When I run it no directory is created. Ideas??

Error message?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Never trust anyone who says money is no object.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php