views:

1774

answers:

3

Recently I was working with generating a PDF from Crystal Reports through a webform. It was failing, which I determined to be caused by the permissions settings on the c:\windows\temp dir. I gave the Network Service account full access to this folder, which promptly fixed the issue. But is there a reason the Network Service account didn't have these permissions by default?

Rick Strahl asks this question here. It sounds like there shouldn't be any issues with doing this, but Rick wasn't clear on why the default is set that way.

Web Server is Windows Server 2003

+1  A: 

These days, the default option will tend to be the more secure one. I don't think there's any other reason.

I've had the same issue as you, and in my environment just gave the permission and moved on.

This post suggests it is the fault of Crystal Reports, which is explicitly referencing %WINDIR%\Temp instead of using an API such as Path.GetTempPath(). In fact I have seen Path.GetTempPath() return %WINDIR%\Temp when running under the Network Service account on Windows 2003.

Joe
I agree, but when I ask my network admins to do things like this they like to lay the burden of proof on me, and tell me things like "they probably had a reason for doing such an such"
Brian Vander Plaats
Network admins, dontcha love 'em :)
Joe
A: 

%windows%\temp is not for general temp'ing and barfing around. It is crystal clear that Crystal Reports is abusing that directory. This happens a lot when developers are too lazy to boot up their machines with anything but an admin account.

Every user (including Network Service) has their own temp space, with full access rights, under Documents & Settings. Winners don't act like CR, and use their own temp spaces.

In short, there is nothing wrong with default permissions on win\temp. I believe it is simply meant for Windows' internal workings. (Then again, it would be much better for everyone concerned, if that directory never existed in the first place.)

Ishmaeel
-1: Under some circumstances I've seen Path.GetTempPath method return the %WINDIR%\Temp directory when running under Network Service account on W2003. It's not just CR - this can cause other problems, e.g. XmlSerializer failing to generate a temporary class.
Joe
Brian Vander Plaats
+1  A: 

This post on creating temp files has comments that support using the windows temp folder.

An msdn article on using the Network Service account states that "if your ASP.NET application needs to use files or folders in other locations, you must specifically enable access" This tells me that the default restriction to the temp folder isn't because the temp folder was singled out, but that all other locations besides the IIS root folder are restricted by default.

Brian Vander Plaats