[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] CGI-scripts and reading/writing files
- Subject: Re: [cobalt-users] CGI-scripts and reading/writing files
- From: "Jelmer Jellema" <cobalt@xxxxxxxxxxxxxxx>
- Date: Thu Apr 18 01:22:42 2002
- Organization: Spin in het Web (www.spininhetweb.nl)
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
----- Original Message -----
From: "Mikael Siirilä" >
> How, on RaQ4, can CGI-scripts be run on a GID that makes read/write
datafiles
> work with chmod 660 for a directory? What adjustments are safe and
commonly
> used in this case?
>
The scripts are run under the identity of the owner of the script, usualy
the site-admin. This owner can read and write files under the site-directory
or in his own homedirectory. So you could do something like
mkdir /home/sites/siteX/data
chown 700 /home/sites/siteX/data
the scripts could then savely read/write to files in this directory. The
could ofcourse create the file itself.
In perl, something like:
------ perl -----
my $home = (getpwuid($>))[7]; #owners home directory
my $sitedir = "$home/../.."; #site's directory
my $data = "$sitedir/data"; #some data directory for cgi-data
mkdir $data, 700;
#write some file
open MYFILE, "> $data/newfile.txt";
print MYFILE "hello world\n";
close MYFILE;
----- end of perl ----
Hope this is what you meant :)
Jelmer