Re: Eu, CGI and file-access
- Posted by Brian Jackson <bjackson at 2FARGON.HYPERMART.NET> Dec 03, 1999
- 444 views
On Fri, 3 Dec 1999 05:41:32 PST, stab master <stabmaster_ at HOTMAIL.COM> wrote: >I'm taking a course at school called "computer-networking", and our teacher >thought that we should do a linux-project since linux is the "ultimate" >networking OS (hrm). Honestly, it truly is. It IS the Internet, and has been since 1965. It takes 3 windows machines to do what 1 Linux box can do. (Brian steps down from soapbox, exits stage left) >So, we all got to install a copy of linux (I chose >RedHat 6.0, wich I very much regret) and set up an apache-server of our own. >Then it was decided that we should learn some CGI. I took a quick look at >Perl before deciding to go with Euphoria. I downloaded Irv Mullins' >CGI-examples for Euphoria and started experimenting. Everything went just >fine until I wanted to save the input-data to a local file. I'm trying to >create and open a file using something like this: >atom fn >fn=open("/home/results.res","wb") > >But open() will return -1 every, single time (argh..). Is there something >I'm doing wrong? Is there some little quirk when running Euphoria under >linux? Or are there perhaps some special rules when opening files through a >CGI-script? If I can't get this working, then I can't see any other way out >than to use Perl instead, and that's something I really don't want. > **************** UNTESTED HYPOTHESIS/SOLUTION FOLLOWS ******************* I not an *expert* at Linux, but I will bet that your server is set up to run all of your CGI scripts as the user 'nobody'. Nobody has no rights to write any data to disk, unless you seriously want to compromise security (i.e, make your whole hard drive writeable to the outside world.) I suggest that you create a new user call 'cgid' (CGI-Daemon), or whatever you like, tell Apache to run all cgi scripts as this user, and then make all your file writes happen in the /home/cgid/ directory. That way, you data is still protected, but you've got write access. I've run into the same type of problems when trying to debug a cgi script (ex.err can't be created either). BTW, if I'm right, you'd be having the same problem in Perl. Good luck, Brian