Take Ownership from the Command Line
It??™s a real pain to dig down through all those windows to take ownership of a
file, only to have to close them all, and then reopen them to subsequently
change the permissions. If you??™re comfortable with the Command Prompt or
you need a way to take ownership from script (see Chapter 9), there are a few
useful tools included with Vista for this purpose.
To assume ownership of a file or folder, use the takeown command. Open a
Command Prompt window, and at the prompt, type:
takeown /f "c:\full_path\myfile.ext"
where c:\full_path\myfile.ext is the full path and filename to take ownership
of. Add the /r option??”only if you??™re specifying a folder name??”to also
take ownership of all the folders and files contained therein. Type takeown /?
for more options.
Next, to set Full Access permissions on the file or folder, use the cacls command,
like this:
cacls "c:\full_path\myfile.ext" /G your_username:F
where your_username is, obviously, your username.
And for those familiar with Unix, there??™s a chown (change ownership) commandline
utility (written for NT but works in Vista) available for free at http://www.
thep.physik.uni-mainz.de/~frink/nt.html.
468 | Chapter 8: Users and Security
To add a user, type one or more names in the Enter the object names to select
field; separate multiple names with semicolons.
In the example in Figure 8-6, notice that the third entry,
SCHOOLBUS\Wendell, is unlike the others.
Pages:
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653