views:

393

answers:

2

We have just moved a website to a new server, both servers are Windows Server 2003 running IIS as the web server.

When uploading images we require that the uploaded files have certain permissions for the NETWORK SERVICE account. Images are uploaded using PHP, they are then filtered by ImageMagick using the mogrify.exe binary for resizing purposes and placed in a new folder created by PHP.

The problem we are encountering is that the uploaded file does not inherit the NETWORK SERVICE permissions although the folder does.

I ran filemon to see any errors and get the following:

mogrify.exe:6396 OPEN C:\inetpub\wwwroot\example.com\data\334480\test.jpg ACCESS DENIED NT AUTHORITY\NETWORK SERVICE

The reason we require NETWORK SERVICE access is due to an ASP.NET script we use to resize the image on the fly. I've searched Google but cannot find a solution. Any ideas?

A: 

Have you made sure the "NETWORK SERVICE" ACL applies to "This folder, sub-folders and files", wherever it is applied. Also, try making a new folder somewhere else with that same ACL and see if files created by PHP inherit the permission.

Rob Golding
Hi Rob, I created a separate script in PHP and a new folder and bypassed the ImageMagick stage, it gives NETWORK SERVICE the same permission as the original script result which is Special Permissions.
Swanny
A: 

Managed to fix the issue, I changed the upload tmp dir in php.ini to C:\Test and gave Test the permissions I required, I had already made this change but on further inspection upload_tmp_dir is set twice in the php.ini file. Uploaded files inherit the permissions of the temporary directory.

Swanny