Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Mapped Drive Permission Issue

Posted on 2008-06-17
3
976 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php56-php-mcrypt for rhel7 php56 1 44
Redirect 301 from one address  to another 5 25
selector:validator cookies 4 30
Row insertion failed. Array 5 46
This article discusses four methods for overlaying images in a container on a web page
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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.

808 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