[REBOL]Cgi Script file access problem
[1/6] from: tim:johnsons-web at: 14-Nov-2000 18:32
Hi:
Am new to linux and apache.
I am running the following script on through apache:
;====
#!/usr/bin/rebol -cs
REBOL[]
print "Content-Type: text/html^/^/"
debug-port: open/new/write make file! "test.txt"
close debug-port
running this from rebol command line as
do %testcgi.r
performs without error message.
Running this as a cgi script ie.
http://localhost/cgi-bin/testcgi.r
returns the following error message from rebol:
** Access Error: Cannot open /home/httpd/cgi-bin/test.txt.
** Where: debug-port: open/new/write make file! "test.txt"
subsitituting
write %test.txt "line one"
returns the following error message from rebol:
** Access Error: Cannot open /home/httpd/cgi-bin/test.txt.
** Where: write %test.txt "line one"
I'm guessing I need to do something with the apache configuration.
Does anyone know what needs to be done?
TIA
-Tim
[2/6] from: cribbsj::oakwood::org at: 15-Nov-2000 8:27
Hi, Tim.
I'm no Linux or Apache expert myself, but I would guess that it is a
permissions problem. Apache is executing your cgi script with the
permissions of user "nobody". I bet the directory /home/httpd/cgi-bin does
not allow write permissions for anyone but user "httpd". Therefore, when
your script attempts to create a file in this directory, it is getting a
permissions error.
Just a guess.
Jamey.
On Tuesday 14 November 2000 22:32, you wrote:
[3/6] from: tim:johnsons-web at: 15-Nov-2000 7:28
Thanks Jamey, I think you are correct...
Now to see how to change that. :)
regards
-Tim
Jamey Cribbs wrote:
[4/6] from: rebol::svendx::dk at: 15-Nov-2000 18:10
Re: gi Script file access problem
Hello Tim,
As Jamey Cribbs pointed out, it's probably a permissions problem.
The safest thing would probably be to create a new directory (ie. /home/httpd/public-write)
and and read-/write-enable it for 'others'.
(It would probably be a bad idea to write-enable your cgi-bin directory...)
something like (in a shell):
mkdir /home/httpd/public-write
chmod o+rw /home/httpd/public-write
But then again, I'm no unix expert either, so...
On 15-Nov-00, you wrote:
> Hi:
> Am new to linux and apache.
<<quoted lines omitted: 21>>
> TIA
> -Tim
Best regards
Thomas Jensen
[5/6] from: cribbsj:oakwood at: 15-Nov-2000 12:14
Re: [REBOL]Cgi Script file access problem
Well, I can think of a couple of suggestions:
1). Change the permissions on your /home/httpd/cgi-bin directory to allow
write access to all users. However, I would strongly recommend AGAINST this
unless this web server is on an intranet that you know is completely secure
and you trust all of the people who could access it. The reason is that you
are giving anyone the ability to write, delete, change files in that
directory.
Again, I don't recommend you do this unless you are absolutely sure. But if
you do decide to do this, simply login as root and type the following command:
chmod o+w /home/httpd/cgi-bin
2). You could change the path in your script to another directory on your
linux box that allows write permissions to everybody. That way, you could
pick a directory that you don't care if somebody blows it away.
That's the only two I can think of off the top of my head. I'm sure some of
the gurus who patrol this list will have others!
Jamey.
On Wednesday 15 November 2000 11:28, you wrote:
[6/6] from: tim:johnsons-web at: 15-Nov-2000 12:41
Hi:
Just a note of thanks to Jamey and Thomas:
It does look like it is a system issue, not a rebol
one. Thanks for the input, I'll get with one of
my lugnut friends. (lug = Linux User Group).
thank-you much!
tj
Jamey Cribbs wrote:
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted