“unblock” an entire directory of files (rather than individually) when copying files between NTFS locations in Windows Server

We copied a few hundred files between a Windows Server 2003 machine and a Windows Server 2008 machine in order to migrate a ASP.NET web application. There are a few hoops to jump through as once it was set up I instantly hit:

Request for the permission of type ‘System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b27b5d561934e089′ failed. (C:\inetpub\wwwroot\WebApp\web.config line 90)

This was related to a “<httpModules>” element in the “Web.config” file.

On searching for similar problems I found a blog post on MSDN which stated that this could be due to a DLL file that needed to be unblocked (right click, “Unblock” button) after copying from another location. Unfortunately, we couldn’t go through and unblock each individual file to try and get round this as there were so many.

The solution (thanks to superuser/StackExchange) is to zip up all the files into one compressed archive before transferring them. Then the NTFS flagging of “unsafe” files that need to be unblocked only includes the one file, simple!

This solved our System.Web.AspNetHostingPermission error straight away, implying that the blocking of files by NTFS for security reasons can affect ASP.NET migration.

Quickly enable NTFS support in CentOS 6.3 using EPEL, yum and ntfs-3g

Enabling NTFS support in CentOS 6.3 is only 2 commands in a shell script and can be done in seconds by installing the EPEL repository and the “ntfs-3g” package.

I needed to transfer some files from my USB drive to CentOS 6.3 (using the USB device option in VMware) and got an error message about an unknown filesystem “ntfs”. The drive I was using was formatted in Windows using the NTFS filesystem and couldn’t be read by my CentOS 6.3 install by default.

First you need to install the Extra Packages for Enterprise Linux (EPEL) repository, which is done by typing the following into the shell as root assuming you are using 32bit CentOS 6.3:

rpm -Uvh http://mirror.overthewire.com.au/pub/epel/6/i386/epel-release-6-7.noarch.rpm

If you are using 64bit CentOS use:

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm

Accept all the prompts to install the repository to get access to a large number of extra packages for CentOS. You can add the “ntfs-3g” package with the following command:

yum install ntfs-3g

Accept all the prompts and you are done, your NTFS formatted drives can now be read from and written to using CentOS.