Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

exec Problem... su not possible?

General discussions related to php

Moderators: macek, egami, gesf

exec Problem... su not possible?

Postby KriS » Tue Nov 26, 2002 7:00 am

Hi,

I'm quite new to php and now I have a problem.
I wrote a PHP Script to edit my ACL propherities for squid.
Now when I have finished editing them, I have to restart squid.
I would like to do this also via Web (PHP)....
but how? I don't want my Apache (user: wwwrun) to run as root.
but wwwrun can't start squid. Only user "squid" with pass "mypass" can start or stop squid. How can I do this?

"exec(su squid /etc/init.d/squid start)"
won't do cos it wants a pass for user squid?

Can anybody help me please?
So long

KriS
KriS
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Nov 26, 2002 6:38 am

Re: exec Problem... su not possible?

Postby WiZARD » Tue Nov 26, 2002 8:23 am

KriS wrote:Hi,

I'm quite new to php and now I have a problem.
I wrote a PHP Script to edit my ACL propherities for squid.
Now when I have finished editing them, I have to restart squid.
I would like to do this also via Web (PHP)....
but how? I don't want my Apache (user: wwwrun) to run as root.
but wwwrun can't start squid. Only user "squid" with pass "mypass" can start or stop squid. How can I do this?

"exec(su squid /etc/init.d/squid start)"
won't do cos it wants a pass for user squid?

Can anybody help me please?
So long

KriS

Hi!
In this situation, i recommend create 2 script (i'm do that before, trying in Perl and PHP - worked), you may if you nanot do this in PHP you may do this in C/Bash shell.
first: login-script for root;
second: logout-script for root;

In PHP script you run first script, <UNIX command>, second script.

In BSDI and Solaris it's work.
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Re: exec Problem... su not possible?

Postby KriS » Wed Nov 27, 2002 6:59 am

WiZARD wrote:Hi!
In this situation, i recommend create 2 script (i'm do that before, trying in Perl and PHP - worked), you may if you nanot do this in PHP you may do this in C/Bash shell.
first: login-script for root;
second: logout-script for root;

In PHP script you run first script, <UNIX command>, second script.

In BSDI and Solaris it's work.


Hi Wizard,

yeah but thats exacly my Problem...
how do I do "su" with a user that has a password, in a script?

Do you have any idea?

thx
So long

KriS
KriS
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Nov 26, 2002 6:38 am

Re: exec Problem... su not possible?

Postby WiZARD » Fri Dec 13, 2002 12:54 am

KriS wrote:
WiZARD wrote:Hi!
In this situation, i recommend create 2 script (i'm do that before, trying in Perl and PHP - worked), you may if you nanot do this in PHP you may do this in C/Bash shell.
first: login-script for root;
second: logout-script for root;

In PHP script you run first script, <UNIX command>, second script.

In BSDI and Solaris it's work.


Hi Wizard,

yeah but thats exacly my Problem...
how do I do "su" with a user that has a password, in a script?

Do you have any idea?

thx
So long

KriS

You also may use sodo. Using this you may configure config for sodo....
Sorry, i dont remember how.... read man about sodo
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.