I've never done it personally, but off-hand (assuming that chmod 444
won't work) I'd suggest you may want to look into using sudo (for
*nix). With sudo you could give the www user permission to become root
only when executing that one command that writes to the file. You'd
have to use a system call of course.

In case that's an appealing option, here's some info to get you
started.
http://www.onlamp.com/pub/a/bsd/2002/08/29/Big_Scary_Daemons.html?page=2

Of course the other option is simply to put the file in a protected
directory, or to use some feature of your web-server such as Apache's
.htaccess files or whathaveyou. That's how I do it.

Anyway, good luck.

> I am writing a perl CGI script on a remote server that is supposed to do the
> following:
>
> 1.  Have the user sign in with a username and password.
> 2.  Allow the user to add News Stories in which that input is taken and then
> written to a text file (Which is as of this moment, set to chmod 777).
> 3.  Allow the user to edit or delete the news added.
>
> All of this works fine, but when I type in the address to the text file
> where the news is stored, I can view it (Don't get me wrong, I know that
> that's supposed to happen, 777 remember?).  Does anyone know of a way, where
> I can not allow ANYONE to view that text file, but still let the program
> write to it?

-- 
=====================
 Shaun Fryer
=====================
 http://sourcery.ca/
 ph: 905-529-0591
=====================

Science is like sex: occasionally something useful
comes out of it, but that's not why we do it.
-: Richard Feynmann



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to