Files are read-only, and refuse to change

I purchased a new SSD and installed Windows 7 64-bit from scratch. I found that my old C: drive, which is now the D: drive, had ownership by an unknown user. I found a way to change the ownerships of everything to my new user ID. However, a lot of files are now read-only, and I can't seem to get rid of the read-only attribute.

I have tried from Windows Explorer, I have tried attrib from an administrative cmd, I have tried cygwin chmod (cygstart -a=runas find . -exec chmod +w {} \;). I see numerous others with the same problem, but don't see any solutions.


Solution 1:

You can restore the default inherited permissions by opening an administrator command prompt and doing, for example:

icacls D:\ /reset /t /c /q

Although I haven't tried it on a whole drive before, this command will restores permissions for all files and directories in the selected location to the default inherited permissions, you will get a message showing the success (and any failures, which there shouldn’t be if you have admin permissions).

This will leave the drive with lots of 'wrong' permissions as a working system but may enable you to read/write files on it if you just want to access them using the drive as a slave.

For more information about icacls, do icacls /? or google ;-)

Solution 2:

One of the ways I used to get around problems like this was by transferring the files to an intermediate filesystem first (discovered this by accident when working with Knoppix and dealing with something similar). Namely, something that did not have filesystem permissions or had less attributes along these lines.

For instance, if I was dealing with NTFS I'd transfer to FAT32 and then finally back to NTFS. This would basically clear the files/folders of any attributes that may be present within the file/folder if that was inherent to the filesystem itself allowing you normal access once more using standard filesystem/attribution utlities once it was transferred to the final target media.