# Allow ColdFusion to access mapped drive?

On our production web server, it has a mapped drive (G:) that goes to the database backup folder of our database server.

I can access it via termainal services easily, no problem.

However, if i want to run a coldfusion app, to work with that directory, it says that directory is empty.

So apparently I need to have the windows user that coldfusion is setup as, Local System, have full access to that mapped drive.

I am not sure of the steps to do this.

The production web server is running Windows Web Server Edition Sp2.

Can you help me setup folder permissions, so i can copy/move files from the mapped drive in coldfusion?

Thank you.

-

You must run ColdFusion service as a domain account instead of the default of "System". Grant the domain account permission on the remote shared directory.

Find the ColdFusion service in the Windows Services app. Double click the service. In the dialog popup, click the Log On tab. Change "Log on as: Local System" to "Log on as: This Account". Then restart the service.

Here's some related info from my blog:

http://www.talkingtree.com/blog/index.cfm/2005/7/27/UNC4CFMX http://www.talkingtree.com/blog/index.cfm/2006/2/20/Improper-Caching-of-File-not-found

-
Not safe to change the ColdFusion Login, not while it's being run. Can I give the user ColdFusion run's as, access to the Mapped Drive? –  crosenblum Mar 8 '11 at 21:37
You can't get access to a mapped drive from a service. You have to use UNC paths. You can give the user ColdFusion is running under (as long as its not "SYSTEM") access, from the other server, access to the UNC path. –  Mr Nil Mar 8 '11 at 22:32

Mapped drives are user specific, however what you can do is something like this:

replace \\10.0.1.1\share with whatever G:\ points at (however would recommend using the IP address of the machine, instead of the name)

copytoserver.cmd:

net use \\10.0.1.1\share /USER:DOMAIN\UserOnDomain passwordofuser
copy c:\path\to\file\to\copy.any \\10.0.1.1\share\
net use \\10.0.1.1\share /delete


somescript.cfm:

<cfexecute name="c:\path\to\copytoserver.cmd"></cfexecute>

-
Interesting answer. It's frustrating how complex it is, to just copy the sql server backup from the database, to the web server, so I can zip it up, and download it to our dev server. Life is complex sometimes :) –  crosenblum Mar 9 '11 at 14:32