<[EMAIL PROTECTED]> wrote:
> Does anyone know if there is a way to execute a shell command in a php
> script? I am trying to execute the following:
>
> /usr/sbin/cadduser -d www.domain.com -f Adrian -u testing -p testing -q
10 -w
> [EMAIL PROTECTED]
If you're running an Apache module version of PHP, the program you are
trying to execute will have to be owned by the same owner as Apache and user
executable (chmod u+x cadduser) or world executable (chmod o+x cadduser)
which is not good from a security standpoint. I'm not certain, but cadduser
seems like the name of a script to add a user to Linux from the Cobalt
RaQ3/4 shell tool package so you're probably running PHP as an Apache
module. The alternative is to install a second copy of PHP as a CGI, in
which case each PHP script runs as the owner of that script. So if an
external program is owned by root, your PHP script can run it through a
shell command by making your PHP script owned by root.
Hopefully that will help you get closer to a solution. If not, you'll
probably get better assistance if you post the answers to the following
questions:
What operating system, who owns the script and what are the permissions on
it? Is PHP running as an Apache module or as a CGI? If it's an Apache
module, what owner does Apache runs as?
Also, if your system is a Cobalt RaQ you may want to post to the
cobalt-users mailing list
(http://list.cobalt.com/mailman/listinfo/cobalt-users/) to signup.
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]