Solved

Mapped Drive Permission Issue

Posted on 2008-06-17
3
971 Views
Last Modified: 2013-12-13
I have a PHP 5 script on a Windows 2003 server running IIS 6.0  The script puts a file on a mapped network drive.  When I log into the server as an administrator and run the script from the command line the file gets written to the mapped drive. When I run the script from a browser it errors out - "no such file or directory". I assume this is a permissions issue with the Internet Guest user trying to write the file as opposed to an administrator writing the file.  I've read some about this and I know one option is to write the file locally and then use a scheduled task to copy the file to the mapped drive.  However, I would rather not go through the extra step.  

I'm pretty new to IIS (I'm used to Apache running on Linux). In reading it seems there are ways to open up the permissions but that it might be a security risk.  Is there a way to give write permissions to a mapped drive without opening myself to a security issue?
0
Comment
Question by:trillian30
  • 2
3 Comments
 
LVL 2

Assisted Solution

by:grahammj
grahammj earned 250 total points
Comment Utility
Have you tried it with the UNC path name?  For example \\server\share\directorypath?

The issue is when you are not logged on, the a mapped drive doesn't exist.  Meaning scripts should be hard coded to use the UNC name.  See what error it gives you after that.

-mjg
0
 

Author Comment

by:trillian30
Comment Utility
The administrator is left as logged in to keep the mapped drive available.  

 When I use the UNC I get the following error: "[function.fopen]: failed to open stream: Invalid argument". Sample of my code (php)    $file = fopen ('\\\myserver\\myshare\\mypath\\test.test','w');

I'm a little confused about permissions when using the UNC.  Our mapped drive has an associated user/password for authentication against the share on the server we are connecting to.  Because we leave the adminstrator logged in, scripts that reference the mapped drive and run from a scheduled task work because the map drive still exists.  If I use UNC in my script  how do I pass the user/password to authenticate against the other sever to get to the shared area?

0
 

Accepted Solution

by:
trillian30 earned 0 total points
Comment Utility
I couldn't find a way to have secure access to the mapped drive on the web server and still allow the files to be written to the mapped drive by the anonymous IIS user, so the files are written to a directory on the web server and then a script runs every 10 minutes to pick the files up and move them to the mapped drive.  Not the most elegant solution, but it works.
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Lync server 2013 Backup Service Error ID 4049 – After File Share Migration
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now