Takeown command-line tool

In Linux/Unix operating systems we find the chown command to change the owner of a file, and what about Windows? Since Windows 2000 as far as I can recall, we can use the Takeown command. It’s not my intention to compare both commands but give and take, they are pretty much similar. Takeowner enables an administrator recover access to a file or a complete folder that previously was denied access to. By making the administrator the owner of the file or folder, access permissions can then be modified according to the administrator/IT requirements. You can have two scenarios, one instance is when a file or folder may have an unknown owner due to a deleted user account or some form of corruption in AD and another instance is when the administrator is asked by security staff to take ownership of files and folders that belong to a specific user. The command takeown allows you to take ownership of files on remote computers as well, for example:

takeown /s <destination> /u <domain\user> /p <password> /f <file> /a /r

Where /a – gives ownership to the administrators group instead of the current logged on user

and /r – performs a recursive call on all files and subdirectories of the target directory

For a full explanation of the takeown command and its parameters, from the command prompt type, takeown /?

Bear in mind that taking ownership of a file in Windows does not give you access rights, therefore, you need to set file permissions afterwards in order to be able to manage the data. From the command line you can use the Icacls command to modify the access control list of that file. From the GUI you can modify permissions through the Security tab; actually you can do the whole process from the GUI – that is, taking ownership and setting access permissions of files and folders.

The main advantage of the takeown command would be when used in scripts to set ownership over a large number of files and folders!

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top