Hi!

On Sun, May 19, 2002 at 10:34:17AM +0200, Per Einar Ellefsen wrote:
> At 10:22 19.05.2002, [EMAIL PROTECTED] wrote:
> >  I have written scripts to add a user to the passwd and shadow files as well
> >as sendmail user files. When I run this script from the command line for
> >testing all runs and completes fine. But when I run the script from apache
> >via the web interface I designed it for, I get file permission errors on the
> >additions to passwd and the rest of the scripts. How can I get the script to
> >access those files?
> You're doing something pretty risky there. the passwd/shadow files are only 
> writable by root. So I suppose that when running them from the command line 

You could let the CGI(or mod_perl)-script write the new user info to a normal
file writable by Apache, and then run a root-owned script (via a cronjob)
that reads this file and then modifies the passwd/shadow file.

Depending on the frequency of the updates, you might want to add file
locking, and depending on the security of your whole system, you could add a
MD5 checksum to each entry, so that nobody with access to your filesystem
can add entries to the Apache-writable file.


-- 
 D_OMM      +---->  http://domm.zsi.at <-----+
 O_xyderkes |       neu:  Arbeitsplatz       |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  +--------------------------------+


Reply via email to