Can't Open file for Read in CGI
[1/9] from: tim::johnsons-web::com at: 14-Apr-2002 19:25
Hello All:
I have a CGI program that evaluates the following:
print read/lines %/home/tim/.bashrc
And I get the following error message:
Cannot open /home/tim/.bashrc
Yet if I evaluate the same command from the
rebol console command line in the same directory
it works.
i.e. : I have the same problem with *any* file that
is prepended with an absolute file path.
Any input on this is appreciated.
Thanks!
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com
[2/9] from: brett:codeconscious at: 15-Apr-2002 17:45
Hi Tim,
A shot in the dark. Could you try an experiment?
Try using this:
print read/lines %"/home/tim/.bashrc"
Brett.
[3/9] from: petr:krenzelok:trz:cz at: 15-Apr-2002 11:13
Tim Johnson wrote:
>Hello All:
> I have a CGI program that evaluates the following:
<<quoted lines omitted: 8>>
> Any input on this is appreciated.
> Thanks!
What about access rights? Your Apache is running in Nobody mode, maybe
you set incorrect rights to your file so it is not visible to CGI
script? You can also try to run your cgi script from your unix console -
switch to the directory where your script resides and type its name and
press enter - should work too ...
-pekr-
[4/9] from: tim:johnsons-web at: 15-Apr-2002 8:38
* Brett Handley <[brett--codeconscious--com]> [020415 00:25]:
> Hi Tim,
>
> A shot in the dark. Could you try an experiment?
>
> Try using this:
Hi Brett:
> print read/lines %"/home/tim/.bashrc"
Error is Cannot open /home/tim/.bashrc.
As per my response to pekr, the problem is
with absolute file paths.
I won't have time for another day before
I have time to cofigure a windows box for
rebol CGI, in the meantime, I'm entertaining
the thought that this may be an apache config
problem. This is the first time that I have
attempted absolute file path access w rebol.
My domain is Linux w/apache, so maybe I'll
try this out there.
regards
-tim-
> Brett.
> ----- Original Message -----
<<quoted lines omitted: 32>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com
[5/9] from: tim:johnsons-web at: 15-Apr-2002 8:33
Re: Can't Open file for Read in CGI/Absolute file path
* Petr Krenzelok <[petr--krenzelok--trz--cz]> [020415 01:50]:
> Tim Johnson wrote:
> >Hello All:
<<quoted lines omitted: 15>>
> > Thanks!
> >
Hello Pekr:
> What about access rights? Your Apache is running in Nobody mode, maybe
> you set incorrect rights to your file so it is not visible to CGI
> script?
Same access rights as any other file I'm doing I/O with in CGI.
> You can also try to run your cgi script from your unix console -
> switch to the directory where your script resides and type its name and
> press enter - should work too ...
Works fine, had checked that too....
The problem as I see it is with *absolute* file paths. (In cgi mode)
Example: via .. for any number of levels (relative path) works too
in CGI.
I am beginning to suspect it is an apache config.
Thanks!
-tim-
> -pekr-
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com
[6/9] from: joel:neely:fedex at: 15-Apr-2002 13:17
Hi, Tim,
Tim Johnson wrote:
> * Petr Krenzelok <[petr--krenzelok--trz--cz]> [020415 01:50]:
> > Tim Johnson wrote:
<<quoted lines omitted: 11>>
> > not visible to CGI script?
> Same access rights as any other file I'm doing I/O with in CGI.
World readable?
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]
[7/9] from: tim::johnsons-web::com at: 15-Apr-2002 11:06
* Joel Neely <[joel--neely--fedex--com]> [020415 10:45]:
> Hi, Tim,
> Tim Johnson wrote:
<<quoted lines omitted: 18>>
> >
> World readable?
Hi Joel:
Sorry, but I don't want to open that up :-)
There's a simple DB at
http://www.johnsons-web.com/cgi-bin/gwcc/GwccClass.r/2
Why do you ask?
Regards
-tim-
> -jn-
> --
<<quoted lines omitted: 6>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com
[8/9] from: brett:codeconscious at: 16-Apr-2002 8:21
Re: Can't Open file for Read in CGI
> As per my response to pekr, the problem is
> with absolute file paths.
I've no idea what REBOL does on linux, but maybe it could be a REBOL
security thing relating to /home
directory.
> My domain is Linux w/apache, so maybe I'll
> try this out there.
I'd like to know what happens.
Brett.
[9/9] from: g:santilli:tiscalinet:it at: 16-Apr-2002 11:07
Hi Tim,
On Monday, April 15, 2002, 6:38:27 PM, you wrote:
TJ> Error is Cannot open /home/tim/.bashrc.
TJ> As per my response to pekr, the problem is
TJ> with absolute file paths.
You mean, you can access it with something like
../../../home/tim/.bashrc (with the proper number of ..)?
If not, then it's just a matter of permissions. The OS takes into
consideration not only the permissions of the file, but also the
permissions of /home and /home/tim. If they don't allow the
Apache's user to enter, you won't be able to read any file in
them. It's usual for Linux to make personal directories (like
/home/tim) only accessible by the owner.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted