This is a discussion on Allowing a CGI script to create and write to a directory within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, I'm running Apache 2.0 on a Windows XP system. I'm using a Perl script which uses ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I'm running Apache 2.0 on a Windows XP system. I'm using a Perl script which uses the Inline C module. When I try to run it I get this error message "Failed to autogenerate C:\Program Files\Apache Group\Apache2\cgi-bin\_Inline\config." and after creating the directory myself this error message in the error log. "Can't open C:\Program Files\Apache Group\Apache2\cgi-bin\_Inline\config for input." How can I give the CGI script permission to create and write to arbitery directories? I'm only doing local testing at home now so sucurity is not an issue. Thanks for the help Steve |
|
|||
|
SketchySteve wrote:
(snipped) > I'm running Apache 2.0 on a Windows XP system. I'm using a Perl script which > uses the Inline C module. When I try to run it I get this error message > "Failed to autogenerate.... > and after creating the directory myself this error message in the error log. > "Can't open C:\Program Files\Apache Group.... > How can I give the CGI script permission to create and write.... This reads to be a permissions problem, or under NT systems, an "ownership" problem. You personally can create a directory because you are equal to a "superuser" or specific system owner. Your Perl program is not running as an "owner" of a specific file system. NT "sees" your program as a rogue trying to write modify files. Research and read about "ownership" under NT systems. Doing so will lead you to the technical details on how to set correct permissions for programs. You will find "things" a lot easier to simply write a "Hello World" script, then tackle ownership. Next move to a script which writes to a file, then tackle ownership. Following those two steps will lead you to quick resolution. #!perl print "Hello World!\n"; open (TEST, ">>test.txt") || die "FUBAR! $!"; print TEST "I am your program. ", scalar localtime, "\n"; close (TEST); print "Exiting Now."; exit; Have fun! Purl Gurl |
|
|||
|
SketchySteve wrote:
> How can I give the CGI script permission to create and write to > arbitery directories? > > I'm only doing local testing at home now so sucurity is not an issue. Steve, Please do not get this the wrong way, but giving write access to CGI scripts, to arbitrary directories, is really not something you should allow yourself to do. Even if for the moment no real security risk exists, I think you will do yourself a great favor to overcome the initial inertia at moving forward on that learning scale, and figure out permissions first before you take the easy way out. The equivalent of what you are seeking, in UNIX, would be to create a setuid root wrapper, and have the CGI bypass all common permissions. Needless to say, that is generally a very bad idea. Security-wise, yes; but simply also because you do not learn anything that way. "Failed to autogenerate C:\Program Files\Apache Group\Apache2\cgi-bin\_Inline\config." The correct thing to do, is to give write permissions to the user Apache runs as, on that specific directory. I am not familiar with that Inline C module you mention; but I must say it looks odd that it seeks to write inside a cgi-bin (sub)dir even. As a rule of thumb, cgi-bin should not be write-accessible to anyone. I'm sure you module can be taught to write somewhere nicely outside the web-tree. Perhaps you can enlighten us as to what you wish to accomplish. I have an inkling that your CGI will probably not need "root" access to achieve your goal. - Pete |
| Thread Tools | |
| Display Modes | |
|
|