?
Solved

Python cgi script can't copy to or modify items on file server

Posted on 2014-08-19
2
Medium Priority
?
455 Views
Last Modified: 2014-08-22
I'm working on an application to be used on our intranet.  It needs to be able to create directories and move files to our file server (N:), and to eventually modify them.  Currently, I'm testing it using IIS (localhost) on my computer.  I'm a novice at IIS by the way.   Okay, I'm using a python cgi script and it is unable to do this...
driveLetter = r'N:'
    picDir = os.path.join(driveLetter,r'FieldPics') #set output directory as N:\FieldPics   
    
    picCountyDir = os.path.join(picDir, str(county[0])) #set output directory as N:\FieldPics\CountyName 
    if not os.path.exists(picCountyDir):
        os.makedirs(picCountyDir) #if necesssary create the county directory inside the N:\FieldPics directory

Open in new window


It tells me, "The system cannot find the path specified."   I have given IUSR and NETWORK SERVICE full control of N:\FieldPics.  I'm unable to figure out what I need to do next.
0
Comment
Question by:Nate_LR
2 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 2000 total points
ID: 40271786
FIrst off, you'll need to use the UNC path rather than a mapped drive.  Mapped drives are based on the security context of the running process and your IIS process won't have an N:\ drive.  
sharePath = r'\\MyServer\myShare'
picDir = os.path.join(sharePath, r'FieldPrice')

Open in new window

If you're allowing anonymous access, your next problem will be a problem with IIS impersonation.  See the microsoft kb article (http://support.microsoft.com/kb/207671) for details.  But basically, you'll need to get IIS to use a network account to access the resource by setting the application pool identity to a domain account:

1) Right-click the Application Pool hosting your CGI process (unless you've made changes it will be the DefaultAppPool)
2) Select Advanced Settings...
3) Update the Identity setting -- switch it to custom and enter the username (domain\username) and password of an account that IIS will use to access the resource
0
 

Author Comment

by:Nate_LR
ID: 40279651
I REALLY appreciate this clockwatcher!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
Suggested Courses

830 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