Friday, February 10, 2012

Files zipped on Mac gave System.UnauthorizedAccessException after transfering to Windows server

I ran into a quite frustrating problem during a deployment of an EPiServer site yesterday, all files in the VPP folder gave me a HTTP 500 error:

“System.UnauthorizedAccessException: Access to the path ‘…’ is denied.”

We’ve all seen this error message before, and the first thing to do is check the access rights on the VPP folders on disk. The access rights were correct, so I went on to checking the VPP and IIS configuration but found nothing wrong.

After double checking configuration, asking everyone available for possible solutions, eating all the cheese in my fridge, checking the configuration yet again, I realized I was clueless. Totally clueless, with Google laughing at me and a customer becoming more and more anxious. At last, however, I found the problem in the most random manner possible.

This is what we did earlier that night:

1) VPP folders were zipped on a Mac
2) The zipped file was transferred to a Windows 2008 server
3) The files were unzipped using the built-in “Extract all” function in Windows.

From what I’ve been able to find out, these steps are what caused the problems. The files zipped on a Mac and extracted using the built-in “Extract all” function in Windows were automatically encrypted!

This does not seem to be an issue if you use WinRAR or 7-Zip, but I haven’t been able to find a more detailed description of why. The closest I’ve come to finding some more information is from this forum thread.

How to decrypt the files:

1) Right-click the VPP folder and choose “Properties”
2) In the General tab, click “Advanced”
3) Uncheck the “Encrypt contents to secure data” checkbox

So it all ended well, but I’d still like to know exactly why Windows encrypted the files during the extraction. If you have the answer, please leave a comment so this can stop annoying me :)

Last, but not least: Thanks to everyone who tried to help!

5 comments:

  1. This happens all the time in our office. I appreciate the post. Glad I am not the only one with this issue. Are you sure that it was a windows encryption error and not encrytion done on the mac while zipping?

    ReplyDelete
    Replies
    1. Hi Joshua,

      Great question! I did some testing in order to find out if the encryption was done by windows or mac:

      1) I zipped a file "test.zip" on a mac.
      2) I transferred the file to windows by ftp
      3) I unzipped the file using the built-in windows "extract all". Result: All files were encrypted
      4) I unzipped the file using WinRAR. Result: No files were encrypted
      5) I unzipped the file using 7-Zip. Result: No files were encrypted

      These results can show one of two things:
      1) The built-in "extract all" encrypts the files when unzipping
      2) The files were encrypted on the mac, and WinRAR and 7-Zip decrypts the files when unzipping.

      I don't find option #2 very likely, what do you think?

      Delete
    2. Interesting misfeature.

      I definitely think theory 1) sounds like the most likely option. (If for no other reason, how would Winrar and 7zip magically know the encryption key?)

      Possibly there is some attribute in the zip archive that the Mac archiver sets and which has a different meaning to the built-in archiving software on the Windows end (which Winrar/7zip do not handle that same way).

      Delete
  2. Well, I have to feel that the windows 7 is at fault. It looks like you and I are not alone in this batter either. I am a bit intrigued on this issue as I run into it constantly when the designers send me their files.
    Here is a good forum thread I was reading since your post so if you care to read it, here it is. http://social.technet.microsoft.com/Forums/en/w7itprogeneral/thread/7acea800-7aba-467e-aba8-9097e63f5e11

    I am going to have to buy my designers some cocktails for all the grief I have given them over the page couple years :)

    ReplyDelete
    Replies
    1. Thanks for the link, I came across it earlier during my search for answers. I find it quite annoying that noone has figured out the exact reason for this though, so far it's all qualified guessing.

      But it's not only Windows 7. I've seen people complain of the same problems in Vista (shocking...) and I experienced this issue on a Windows 2008 server.

      At least your designers will be happy for the cocktails :) It hurts to admit Mac isn't causing the problem, right?

      Delete