views:

462

answers:

2

According to http://support.microsoft.com/kb/326549 the read only attribute is typically used for reasons other than marking a folder as actually read-only. Therefore it seems to me that it is not possible to make a directory read only in the same sense as linux using chmod a-w.

+1  A: 

This is true of the readonly flag. You CAN however use NTFS ACL's to do this. I forget exactly how this is done now, and it will only work for NTFS filesystems, but it's possible.

Relevant links:

Specifically: http://www.ntfs.com/ntfs-permissions-setting.htm

Matthew Scharley
+1  A: 

Interesting, I didn't know that! I just tried it, you can set the readonly attribute on a folder with the attrib command, but it has no effect.

The only alternative I see is setting the access rights to the directory based on the user account, if it is on an NTFS formatted drive. Have a look at the Xcacls tool from Microsoft.

Take care though, access permissions on NTFS are a good deal more complex than unix type access control. In general it's better to not allow a specific kind of access, than to deny it. I think this is no longer a problem today, but I remember back on good old NT 4, a freind of mine managed to deny all access to a folder, including the administrator account. He couldn't do anything afterwards, not even delete it...

Treb
If you deny all access, you can "Take Ownership", which will allow you to reset the ACLs.
Paul Betts