Have you ever wondered why you can navigate to your user name folder under C: drive → Users and can’t open the folder called “My Music?” Have you wondered about why Vista won’t let you access files on an older hard drive from a computer that used your very same user name and that you own?
Even though these seem to be the same problem, they are actually separate issues. Here we’ll look at how when it is and is not a good idea to take ownership of a file, folder, or an entire hard drive and how those virtual folders like My Documents and My Music in Windows 7 and Vista work.
Ownership in Windows 7
Takeown is a command-line utility program that famously allows “an administrator to recover access to a file that was denied by reassigning file ownership.” It is most often used in a “quick and dirty” fashion to wrench away ownership of a file or folder when Windows inexplicably decides that it owns the sole rights to it.
The ownership model in Windows includes everyone, users, administrators, and system. Permissions and ownership are related, but they are not the same thing. For example, the system can own a file that administrators and users are granted “full control” over. These are permissions.
For another example, let’s look at a log file that is generated in the Vista Windows directory. Microsoft is pretty clear that users have no need to be mucking around in the Windows folder, but what if we need to manipulate the file? We can copy it out to the desktop, but the permissions come with it. The user cannot change or edit the file without becoming an administrator. Not only is this a minor pain, it’s also unneeded for what is really just a text file.
So we right-click the file and go into the security settings. We click “Continue” and add our name as a party to have some control over the file. We click “Check name” and if the system finds us (ComputerName/User is the usual reply), then we have Windows’ blessing to become a concerned party. With this, we can select “Full Control” and obtain all the permissions to do what administrators or the system itself can do to the file.
This effectively renders all the trappings of ownership, allowing us to manipulate the log file at will, but we don’t actually own the file. Let’s take a closer look at ownership in Windows 7 and Vista.
At the most basic level, every object in Windows, which are by definition files (even directories are really a type of file), has an owner. The owner decides how permissions are set and to whom permissions are granted. The owner is the entity that created the object, and it can set permissions on the object even when denied all access to the object. In other words, ownership is persistent.
That’s why when we copied the log file out of the Windows directory to our desktop, we did not take ownership of the file. That ownership still resided with the process that created it. We manipulated the permissions so that, effectively, we could act as if we had taken ownership, but in reality, we did not.
Microsoft says that about 85% of modern PCs are used by a single user. Administrators in Vista or Windows 7, which we become when we click on a UAC prompt a couple of times, have the right to take ownership of a file or folder. Once this is done, we can even give away the ownership to ourselves as the user. This then avoids the UAC prompt when we make use of the file or folder.
So we see that ownership and full control by permissions are highly related in Windows 7 and Vista, but are not the same thing at all.
When do we most often find ourselves needing to know about taking ownership? When we’re locked out of our own stuff, of course.
Such is the situation when we get a new computer and decide to put our old hard drive into an external enclosure in order to continue using it. If Windows allows us to copy some files from the drive to the new computer, that’s great. After a while, however, we begin to think about how much storage space we’d free up on that old drive if we nuked the Windows and Program Files folders there. And so we right-click the Windows folder on that drive, hold down Shift, and select Delete. Windows then declares that we need permission to continue, and then, illogically, pops up a second prompt to ask if we want to continue. We doggedly keep clicking, and then Windows tells us…
So, recently having become fluent in the practice of giving ourself permissions to take full control, we attempt to do this by adding ourself as a user. Again, access is denied.
What’s the problem here? The problem is that the entity that owns that folder stills controls it even though it has lost access to it. (And Windows still thinks you have no business mucking around in a Windows folder.)
The implication here, of course, is that the PC administrator is not all-powerful. The further implication is that this is a logical hole in the theory of ownership and permissions in Windows.
And into this hole nicely fits the takeown command, which we’ll look at next.
But First, A Note…
Never, ever try to take ownership of the entire hard drive on which Windows 7 or Vista is installed. That will change so many permissions that Windows won’t be able to run. In other words, the castle will topple, and you’ll have to format the drive and reinstall Windows, so don’t do that.
The Takeown Command
To take ownership of the Windows folder on an old hard drive, you need to start with an elevated command prompt. Do this by going to Start → All Programs → Accessories, right-clicking “Command Prompt,” and selecting “Run as administrator.”
In the command-prompt window, type the name of your external hard drive (D:, F:, etc.) and press enter to go to that hard drive. To take ownership of the Windows directory, enter
takeown /F F:\Windows /R
substituting the name of your hard drive letter assignment where I’ve used “F:” This translates into “take ownership of the file or folder Windows on the F: drive and do it recursively, which means to do the same to each subdirectory.”
When the process completes, enter
del F:\Windows /F /Q
which means “delete the Windows folder on the F: drive, including all read-only files, and be quiet about it.”
At this point, you will have erased the old, useless Windows folder and freed up some space on your old hard drive, so type
to close the command-prompt window.
There are just a couple more points to note. The takeown command, by default, gives ownership to the current user, which because we ran it from an elevated command prompt was the PC administrator. This was all right because we planned to delete the folder immediately after taking ownership.
In a variation of the command, you can use the /U switch to specify a user on the PC as the new owner. However, as it’s possible that you don’t actually know the exact computer name of the user (mine is “PC2007/Lamar”), it’s easier to edit the permissions for a file or folder by right-clicking and letting the name search feature find the user and then give the user full control permission.
So it all comes back to ownership and permissions.
My Music and Vista
And to get back where we started, how come we can’t open or navigate to My Music in Vista?
That’s because it’s not really there. My Music is called just “Music” in Vista. The My Music folder on the hard drive is just a junction or a signpost pointing old applications to the Music folder.
I hope this article has helped you remove something you didn’t want or to access something that you were locked out of. Thank you for visiting Bright Hub, and thank you for reading this.