Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm running a CGI script on a windows server. When I run the script from the command line (as myself), I have no problems mapping another directory. But when I try to run it from the web browser, it just won't do it. I've tried the Map command with the username and password options, but it still won't work. Any ideas??

Replies are listed 'Best First'.
Re: Trouble mapping directory
by tachyon (Chancellor) on Sep 25, 2003 at 01:20 UTC

    Any ideas??

    1. Permissions. Apache/IIS has different perms to you and is not able to access the dir. Add the Apache/IIS user to the access list for your dir and it will work. Opening the directory with read for everyone will also work but may not be what you want. There is a Win32::Perms module that lets you set Win32/NT perms from Perl
    2. Post code.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Trouble mapping directory
by sunadmn (Curate) on Sep 25, 2003 at 01:39 UTC
    Are you running IIS ( if so what version ) or Apache on win32?? IIS has to beable to get to the dir in question so it has to relivant to the web server root and has to have the correct global read perms i.e. anyone. The same should also apply to Apache. -Sunadmn
Re: Trouble mapping directory (security context)
by tye (Sage) on Sep 25, 2003 at 16:30 UTC

    Two problems. First, the CGI process is probably being run as a user other than you. For IIS, there is a special user that gets created just for this purpose. That user most likely has no access to the particular directory that you want to map.

    Second, even if you give the web user access (read-only access, I'd hope -- otherwise a rather risky proposition) or change which user the web server runs CGIs as (also a rather risky proposition), some web servers will run CGIs in a security context that does not allow access to any "Windows networking" resources (no matter what user they are).

                    - tye