0

I haven't done anything on a windows machine since I started doing serious sys-admin and development work (all *nix). So I may be asking something easy - but I haven't found the answer by searching.

I've got Windows Server 2008 running Apache 2.2. I can run the "printenv.pl" perl script that came in the cgi-bin dir along with the Apache install just fine...

However, with a script that does the following:

#!c:\perl\bin\perl.exe
print "Content-Type: text/plain; charset=iso-8859-1\n\n";
print `type C:\\Some\\Dir\\file.txt`;

My apache log just says:

[Tue Jun 22 13:13:55 2010] [error] [client 68.230.22.34] Access is denied.\r

I can run the same perl script from the dos prompt - so I know it works for my user. I can see in Task Manager that httpd.exe is running with user SYSTEM, so I made sure file.txt was readable to SYSTEM. I even made it readable to Everyone at one point - but I still get the "access is denied" error.

Thanks...

EMiller
  • 205
  • 2
  • 12

2 Answers2

1

Are you certain that the user 'SYSTEM' can execute perl.exe?

Tyler K
  • 256
  • 1
  • 6
  • Yes, based on the fact that I can run that 'printenv.pl' script through Apache... I checked the properties on the exe as well to be sure... – EMiller Jun 22 '10 at 21:09
  • Are you certain that Apache isn't jailed to the directory? Where exactly is the file.txt? Try moving a copy into the Apache directory it is serving from to make sure. – Tyler K Jun 22 '10 at 21:20
  • That's a good call - I will try asap. What would "jailed" mean on a windows machine? (what controls that, and where is it configured) – EMiller Jun 22 '10 at 22:25
  • I'm afraid you've hit my Windows knowledge wall. I can't answer that and google isn't turning anything up. – Tyler K Jun 23 '10 at 05:48
  • Thanks - well you've pointed me in the right direction ... I've confirmed I can 'type' out a file within cgi-bin ... and even when I add the *other* path as an apache 'Alias' and add a corresponding '' section to allow browsing - I get a permission denied... – EMiller Jun 23 '10 at 16:10
0

Well - it turned out that the C:\some\dir\file.txt file was encrypted. It took me a while, but I finally started to wonder: "why is that folder in green text" in windows explorer. I have no idea why, but I copied a zip file over, and when they extracted they were encrypted. As soon as I turned that off, the perl script could read.

EMiller
  • 205
  • 2
  • 12