On Fri, 13 Aug 2004 02:22:45 -0700, anr wrote:
I have made a solution where a user is added to the system and a folder
is set up for him. In order to make the folder webDAV accessible for
him I have to add some lines to the current httpd.conf file and restart
the webserver. Is this possible to do from my php script - or even
advisable?
I could envision an alternative where i would make a cron job restart
httpd every 15 minutes or so, but i would prefer the first method.
Is this possible?
Of course it is possible! Make a little C program which will contain the
following sequence of commands:
/*
The definition of INIT depends on your OS. It may be /etc/init or
even /bin/init.
*/
#define INIT "/sbin/init 6"
#define ROOT 0
setuid((uid_t) ROOT);
system(INIT);
Then make that program setuid root (chown root prog; chmod 4755 prog)
and put in the path visible by PHP scripts. All you need is to execute
the program using "system" from a PHP script. As per that being advisable,
any manual or article about the computer security will tell you exactly
how advisable is that.
--
A city is a large community where people are lonesome together.