Loading ...
Sorry, an error occurred while loading the content.

Re: reading a windows network directory using a cgi script

Expand Messages
  • roish1973
    ... can ... as ... roi: Hi. thanks for your help. what i m tring to do is to read a directory of a network server, and select one of the folder files. the
    Message 1 of 5 , May 4, 2004
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, "Jenda Krynicky" <Jenda@K...>
      wrote:
      > From: "roish1973" <roi__@h...>
      > > a cgi script post data to a perl script located in a different
      > > network.
      > >
      > > that perl script address a module which opens a directory on that
      > > network and returns a requested file name.
      > >
      > > please note, that running the perl script from the network, the
      > > requested file is returned.
      > >
      > > Yet, triggering the perl script using the CGI page, the directory
      can
      > > not get opened.
      > >
      > > the network is a Win32.
      > >
      > > directory is: $dir= \\\\[server name]\\c\$\\[folder name] ;
      > > the open dir function is: opendir(DIRHANDLE,$dir);
      > >
      > > any ideas ?
      >
      > If something works from the command line, but does not via CGI the
      > most likely culprit is permissions (and the second one is different
      > current working directory). Most likely the CGI script is running
      as
      > a user that cannot access the admin share, quite likely the account
      > cannot access any network share at all.
      >
      > Anyway I'm not really sure what are you trying to do.
      >
      > Jenda
      > ===== Jenda@K... === http://Jenda.Krynicky.cz =====
      > When it comes to wine, women and song, wizards are allowed
      > to get drunk and croon as much as they like.
      > -- Terry Pratchett in Sourcery

      roi:

      Hi. thanks for your help.
      what i'm tring to do is to read a directory of a network server,
      and select one of the folder files.

      the error i'm getting while trying to open the directory is:
      cant open directory [directory path], no such fileor directory.

      jenda wrote:
      a user that cannot access the admin share, quite likely the account
      cannot access any network share at all.

      is there any way to fool the perl script, set different values
      to the ENV varables or what ever, to enable reading the
      directory ?

      thanks.

      Roi
    • daymobrew@yahoo.com
      ... To access admin shares the easiest way is probably to add the web server user to the Administrators group. For non-admin shares you could add the web
      Message 2 of 5 , May 4, 2004
      • 0 Attachment
        --- In perl-beginner@yahoogroups.com, "roish1973" <roi__@h...> wrote:
        > --- In perl-beginner@yahoogroups.com, "Jenda Krynicky" <Jenda@K...>
        > wrote:
        > > From: "roish1973" <roi__@h...>
        > > > a cgi script post data to a perl script located in a different
        > > > network.
        > > >
        > > > that perl script address a module which opens a directory on that
        > > > network and returns a requested file name.
        > > >
        > > > please note, that running the perl script from the network, the
        > > > requested file is returned.
        > > >
        > > > Yet, triggering the perl script using the CGI page, the directory
        > can
        > > > not get opened.
        > > >
        > > > the network is a Win32.
        > > >
        > > > directory is: $dir= \\\\[server name]\\c\$\\[folder name] ;
        > > > the open dir function is: opendir(DIRHANDLE,$dir);
        > > >
        > > > any ideas ?
        > >
        > > If something works from the command line, but does not via CGI the
        > > most likely culprit is permissions (and the second one is different
        > > current working directory). Most likely the CGI script is running
        > as
        > > a user that cannot access the admin share, quite likely the account
        > > cannot access any network share at all.
        > >
        > > Anyway I'm not really sure what are you trying to do.
        > >
        > > Jenda
        > > ===== Jenda@K... === http://Jenda.Krynicky.cz =====
        > > When it comes to wine, women and song, wizards are allowed
        > > to get drunk and croon as much as they like.
        > > -- Terry Pratchett in Sourcery
        >
        > roi:
        >
        > Hi. thanks for your help.
        > what i'm tring to do is to read a directory of a network server,
        > and select one of the folder files.
        >
        > the error i'm getting while trying to open the directory is:
        > cant open directory [directory path], no such fileor directory.
        >
        > jenda wrote:
        > a user that cannot access the admin share, quite likely the account
        > cannot access any network share at all.
        >
        > is there any way to fool the perl script, set different values
        > to the ENV varables or what ever, to enable reading the
        > directory ?
        >
        > thanks.
        >
        > Roi

        To access admin shares the easiest way is probably to add the web
        server user to the Administrators group.
        For non-admin shares you could add the web server user to the list of
        users that can read those shares.
        This may not be a good idea but you might be able to set the web
        server user account so that no one can login as that user. Disabling
        the account might allow you to run the CGI and read the admin share
        but no one would be able to log in as the user.

        I'm doing a lot of guessing here.
      • Jenda Krynicky
        From: roish1973 ... Depends on your web server. If you are running MS IIS then the scripts are most likely being run under the
        Message 3 of 5 , May 4, 2004
        • 0 Attachment
          From: "roish1973" <roi__@...>
          > Hi. thanks for your help.
          > what i'm tring to do is to read a directory of a network server, and
          > select one of the folder files.
          >
          > the error i'm getting while trying to open the directory is:
          > cant open directory [directory path], no such fileor directory.
          >
          > jenda wrote:
          > a user that cannot access the admin share, quite likely the account
          > cannot access any network share at all.
          >
          > is there any way to fool the perl script, set different values to
          > the ENV varables or what ever, to enable reading the directory ?

          Depends on your web server. If you are running MS IIS then the
          scripts are most likely being run under the IUSR_machinename account.
          You may change this in the "Internet Services Manager" (or Computer
          Management\Services and Applications\Internet Information Services)

          The scripts should NEVER be run under an administrator account!

          In this case you will most probably need to create a new network
          account (with as small permissions as possible), change the account
          used for the Anonymous access for the website or directory, create a
          share on the server storing the files and give this user read (and
          modify if really necessary) permissions to the share and the files.


          It might still be best to have the files copied onto the webserver
          and accessed localy.

          Jenda
          ===== Jenda@... === http://Jenda.Krynicky.cz =====
          When it comes to wine, women and song, wizards are allowed
          to get drunk and croon as much as they like.
          -- Terry Pratchett in Sourcery
        Your message has been successfully submitted and would be delivered to recipients shortly.