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

Hi, Monks
I have an issue where if I run this code from my computer I get :" Couldn't open //myserver/app/finder/users.txt for reading: Permission denied". And I do have permissions
But if I type the path to a browser a can open the file no problem.
Any thing wrong there or there is a better way of doing this?
my $export_file = "//myserver/app/finder/users.txt"; print "****Path = $export_file *****"; open(SOURCE, "< $export_file") or die "Couldn't open $export_file for +reading: $!\n";{ my @raw_data=<SOURCE>; print "****** @raw_data ******<br>"; close(SOURCE); }

Thanks or the help!

Replies are listed 'Best First'.
Re: File Open Problem
by Joost (Canon) on Aug 25, 2005 at 14:41 UTC
    Your code suggests you're running this program as a CGI (i.e. from a webserver). If so, does the webserver run as a user with sufficient permissions to open the file, and is it logged in to the remote server?

    Also, this looks like a windows shared directory, which has some issues IIRC; you might have better luck mounting the remote dir as a drive and then accessing the file as "G:/finder/users.txt".

Re: File Open Problem
by holli (Abbot) on Aug 25, 2005 at 14:44 UTC