Categories
Rails

Windows + IIS + Rails + Paperclip + Uploaded files give Errno::EACCES (Permission denied)

This was driving me nuts – not my preferred setup, especially now-a-days Rails + Windows really don’t play nice together.

I was having an issue with uploaded files (or in my case generated pdf files that were attached to the model using Paperclip) giving Permission Denied errors after they’d been created.

The Solution

Find the temp folder for the user of the application pool (or the user account for the web app) for me it was:

C:\Users\invoicing.IIS APPPOOL\AppData\Local\Temp

Then change the Temp folder permissions to include the IIS_USRS account.

Why?

Paperclip/Ruby creates the uploaded file in the temp folder location before copying to the relevant location in your Paperclip folder structure.  Unfortunately, when it does this, it takes the permissions from where it was first created (in this case the Temp folder). By adding the IIS user account to the folder permissions these get copied across too.

NB: If you really do need to deploy to Windows do yourself a favour and use Helicon Zoo – works great with IIS.

Leave a Reply

Your email address will not be published. Required fields are marked *