Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

writing to a network drive 3

Status
Not open for further replies.

rshandy

Technical User
Dec 26, 2003
91
US
I wrote a script that runs on our local internet iis server. the script resides in the servername/inetpub/scripts folder.

I'm trying to simply open a mapped drive file, write to it, and close it.

I can write to any local disk and subfolder i.e. c: or d: in this case, but not any network drive (another computer). I get an error when it trys to open the file:

below is a snippet of the code:

my $iclib = "upload3.txt";
open (OUTPUT6, ">g:\\$iclib") || die "Error opening file $iclib";

- "g" is the network drive. If I replace "g" with "c" (the local disk) I'm able to open the file just fine.

I also checked the shared permissions that the map drive is pointing to and it looks fine.

Any ideas??

Thanks,

Rich


 
Try this to start with - it will give you a better error message.

open (OUTPUT6, ">g:\\$iclib")
[tab]|| die "Error opening file $iclib\n$!\n";


Mike

"Deliver me from that bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Aha!!

Error message: Error opening file upload3.txt
Permission denied

The server is w2k and the machine I'm trying to write is running W98 - also its not part of the network but is accessible via a peer to peer.

When I'm on the server, I can access the network drive, create a file...

Is there a permission issue from the scripts folder on the server???



 
How is the perl script being called when it fails?

Can I suggest the following?

On the w2k server, open a cmd window.
Create a file on the W98 server - just to confirm that it works.
Then run the following, minimal, perl script from that same cmd window.

open (F, ">g:/upload57.txt")
|| die "Error opening file g:/upload57.txt\n$!\n";
close(F);



Mike

"Deliver me from that bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Hi Mike:

I'm calling the script from a browser - the script resides in the /servername/inetpub/scripts folder.

It seems the server permissions are preventing me from writing to the F: drive when calling the script from a browser

I ran the test script you suggested from the command window c:/inetpub/scripts> writenetdrive.pl

Worked fine.

When I tried to run the same script from the browser
Path:



I received the following error message:

Error opening file g:/upload57.txt
Permission denied

Is it something regarding the permissions in the iis server?



thanks for you help
 
It'll be the user-name which the server runs under then. I bet it's different to the one you login as.

Mike

"Deliver me from that bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
not sure what you mean as far as the user-name which the server runs under? Do you mean the main user, like the administrator?

I tried to run the script from another computer on the network as well as the server itself. When I run the script on the server, I am logged in as the administrator, so it should be the same name.

Is that what you meant?

Sorry I'm a little bit of a rookie!
 
That's ok, we're all rookies when we step out of the areas we know best.

IIS runs as a service doesn't it? Have a look in control panel/services and see if there's an option talking about user-names for the IIS service.

Mike

"Deliver me from that bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
been trying so many different combinations - folder locations, etc.

Tried creating virtual directories in the iis manager.

Seems like I can't create the virtual directories in the directory, only either as a subfolder in the scripts directory or a subdirectory in the intranet directory

Unfortunately, there's this "stop sign" icon next to it the folder name(virtual directory) with the word "error".

Can't seem to nip it!!

oh, a few other things I haven't set up the exchange server yet either, and ironically, it also has the stop sign icon.

any more ideas??
 
rshandy,

MikeLacey has probably pointed you in the right direction.

Your web service runs in the background from your server and is logged into the computer like you are as the user specified in the configuration. The web service will have the same rights to your network as the user it is identified as. The user may not have access to your remote directories.

Michael Libeson
 
When you say "user" may not have access to the remote directories, are you referring to who you are logged in as?

right now, I'm using the browser on the server, logged in as the administrator.

wouldn't that present the same permissions?

also, what does the "stop sign" in the iis manager mean - I can't seem to get a definitive error
 
You may be logged in to your computer as administrator by your web service could be running as userX.

The stop sign means the service did not start. Either the service is not set to automatically start or there was an error trying to start the service. Check your event logs for more information.


Michael Libeson
 
Unless a new username is stated, IIS runs under the user name of IUSER_<servername> where <servername> is replaced with the name of the computer IIS is running on. To allow the website access to the other machine, that user must be added to the acceptable users of the machine.

- Rieekan
 
Thank you guys... My lack of IIS knowledge showing there.

Mike

"Deliver me from that bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Hi Mike, Michael and Reiken!!

I want to thank everybody for helping me along. Its now working!!!!

Here's are recap for anyone that may encounter the same difficulties in writing/reading/executing a file to a different computer from an IIS server.

in the iis manager console, I needed to create a virtual directory.

I received the stop sign error, due to permission inconsistencies.

Rieekan/Michael Libeson
was correct in that I needed to create permissions for the IUSR_servername user.

I know that most of you know the path protocol in perl, but I thought maybe I could use the local path of the newly created directory in my script but (i.e c:\\inetpub\virtdir), but I couldn't get that to work.

I had to use the absolute path of the remote machine i.e. \\\\remote_machine\\virtdir

I want to that you all once again for time and helpful information.

Mikelacey, that's again for helping and hangin with me.

Sincerely,

Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top