Solved

Mapped Drive Permission Issue

Posted on 2008-06-17
3
972 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
ID: 21807899
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
ID: 21814361
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
ID: 21963913
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
datetime in sql 6 31
is this a cms? 8 35
Windows IIS SMTP Server Unable to relay emails 12 26
PHP & MySQL - Rounding Results from a Select Query 3 13
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

867 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

21 Experts available now in Live!

Get 1:1 Help Now