Tech Line

Read-Only Attribute Aggravation

When read-only doesn’t necessarily mean “read-only.”

Chris: How do I remove the read-only attribute on the of all folders in Windows 2003? I’ve read Bill Boswell’s article, "Rally 'Round the Tri-Mode Flag" and am still having some trouble.
— Kaweewat

Tech Help—Just An
E-Mail Away

Got a Windows, Exchange or virtualization question or need troubleshooting help? Or maybe you want a better explanation than provided in the manuals? Describe your dilemma in an e-mail to the MCPmag.com editors at mailto:[email protected]; the best questions get answered in this column and garner the questioner with a nifty MCPmag.com baseball-style cap.

When you send your questions, please include your full first and last name, location, certifications (if any) with your message. (If you prefer to remain anonymous, specify this in your message, but submit the requested information for verification purposes.)

Kaweewat, the problem you describe is probably amongst one of greatest annoyances many Windows administrators have had to deal with in recent years. Sometimes I think that the cure for baldness among network administrators would be providing them with dialog boxes that actually show them what they expect. Clearing the read-only attribute from a folder on a Windows 2003 system is a classic example of this. Here’s the typical scenario:

  1. You view the properties of a folder in Windows Explorer.
  2. At first, you note that the read-only attribute checkbox is grayed out. However, you are still able to clear the check mark from the box.
  3. If you click Apply, you’ll see the operating system actually appear to be removing the read-only attribute from the folder’s subfolders and files.
  4. You click OK to close the folder properties dialog box. Then you right-click on the same folder and select Properties. Once again, the read-only attribute box is grayed out and the box is checked!

For the admins that have sided against pulling out their hair, something usually goes flying across the office at this point. When you view the grayed-out checkbox, what it’s really telling you is that the Tri-mode flag has been set. I know, picking up that clue is like me understanding that I forgot to bring home milk when I get the stare from my wife. When the stare arrives, I follow up with something like “What? Did I forget to take the garbage out? Is my zipper down?” You get the idea.

Now on to the tri-mode flag. What the grayed-out and checked Read-only checkbox is telling you is that subfolders and files of the folder may have the read-only attribute and not the folder itself. While that’s fine, what drives most administrators crazy is that, in theory, if you go through the motions of removing the read-only attribute not only from a parent folder but also select the option to remove the attribute from all subfolders and files, then the read-only tri-mode flag should no longer be set. Since it still will be, let’s look at the cause of this problem.

This specific issue is fully explained in Microsoft KnowledgeBase article 326549, "You Cannot View or Change the Read-Only or System Attribute of Folders." The bottom line with the read-only attribute when viewed as the properties of a folder is that seeing the tri-mode flag set for the read-only attribute does not mean that the folder (or any subfolders or files) have the read-only attribute. Instead, it may imply that the folder is deemed a “special folder.” For example, folders that support customized views are special folders.

To see this default behavior in action, just create a new blank folder on a Windows Server 2003 system, you should see that the read-only checkbox is selected (via the tri-mode flag) in the object’s properties. Keep in mind that the newly created folder does not even have any subfolders! If you run the attrib command to see the attributes of the folder, you'll see that it is not marked as read-only.

So the bottom line with seeing the read-only attribute in Windows Explorer is that it’s not a reliable indication of whether or not subfolders or files in that folder are actually read-only. The best way to ensure that the read-only attribute is removed from all subfolders and files in a folder is to navigate to the folder from the command prompt and then run the command attrib –r /s /d. This removes the read-only attribute from all files and folders within the target folder, as well as its subfolders. If you want to query for the presence of any files or folders marked as read-only, you can navigate to the folder from the command prompt and run dir /ar /s. If the command does not return any files as read-only, then you know that there are no longer any read-only files contained in the folder or any of its subfolders. Note that with customized folders, removing the read-only attribute from the folder may result in the customizations being lost. Microsoft referenced this problem in KB 326549, in stating that “If you remove the Read-only or System attribute from a folder, it may appear as a[n] ordinary folder and some customizations may be lost.”

Finally, if you’re having problems writing to a folder that has the tri-mode flag of the read-only attribute set, don’t forget to check permissions. Since Windows Server 2003’s default share permissions are Everyone-Read, any newly shared folder will only offer read-only access by default.

Now that I’ve said that, I’d better go apologize to my wife for my earlier sarcastic comment. Otherwise it’s another night on the couch with the dogs.

About the Author

Chris Wolf is a Microsoft MVP for Windows --Virtual Machine and is a MCSE, MCT, and CCNA. He's a Senior Analyst for Burton Group who specializes in the areas of virtualization solutions, high availability, storage and enterprise management. Chris is the author of Virtualization: From the Desktop to the Enterprise (Apress), Troubleshooting Microsoft Technologies (Addison Wesley), and a contributor to the Windows Server 2003 Deployment Kit (Microsoft Press).learningstore-20/">Troubleshooting Microsoft Technologies (Addison Wesley) and a contributor to the Windows Server 2003 Deployment Kit (Microsoft Press).

comments powered by Disqus
Most   Popular