takeown
Enables an administrator to recover access to a file that previously was denied, by making the administrator the owner of the file. Windows commands reference
On Windows 2 Sigma rules name it File takeown.exe
Windows
Enables an administrator to recover access to a file that previously was denied, by making the administrator the owner of the file. This command is typically used on batch files. - Mixed patterns using (? and *) aren't supported by takeown command. - After deleting the lock with takeown, you might have to use Windows Explorer to give yourself full permissions to the files and directories before you can delete them.
takeown [/s <computer> [/u [<domain>\]<username> [/p [<password>]]]] /f <filename> [/a] [/r [/d {Y|N}]]
To take ownership of a file named Lostfile, type
takeown /f lostfileIdentify/fSpecifies the file name or directory name pattern. Windows commands referenceTrips 1 Sigma rule: mediumFile or Folder Permissions Modifications by Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems)
/s <computer>Specifies the name or IP address of a remote computer (do not use backslashes). The default value is the local computer. This parameter applies to all of the files and folders specified in the command./u [<domain>\]<username>Runs the script with the permissions of the specified user account. The default value is system permissions./f <filename>Specifies the file name or directory name pattern. You can use the wildcard character * when specifying the pattern. You can also use the syntax <sharename>\<filename>./aGives ownership to the Administrators group instead of the current user. If you don't specify this option, file ownership is given to the user who is currently logged on to the computer./rPerforms a recursive operation on all files in the specified directory and subdirectories./d {Y | N}Suppresses the confirmation prompt that is displayed when the current user does not have the List Folder and Read permissions on a specified directory, and instead uses the specified default value. Valid values for the /d option are:
- Y - Take ownership of the directory. The directory permissions are replaced with permission granting the user full control only.
- N - Skip the directory.
NOTE
You must use this option in conjunction with the /r option./?Displays help at the command prompt.Windows
Take ownership of a file or directory.
Take ownership of the specified file
takeown /f path\to\fileIdentify/fSpecifies the file name or directory name pattern. Windows commands referenceTrips 1 Sigma rule: mediumFile or Folder Permissions Modifications by Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems)
Take ownership of the specified directory
takeown /d path\to\directoryIdentify/dSuppresses the confirmation prompt that is displayed when the current user does not have the List Folder and Read permissions on a specified directory, and instead uses the specified default value. Windows commands referenceTrips 1 Sigma rule: mediumFile or Folder Permissions Modifications by Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems)
Take ownership of the specified directory and all subdirectories
takeown /r /d path\to\directoryIdentify/rPerforms a recursive operation on all files in the specified directory and subdirectories. Windows commands reference/dSuppresses the confirmation prompt that is displayed when the current user does not have the List Folder and Read permissions on a specified directory, and instead uses the specified default value. Windows commands referenceTrips 1 Sigma rule: mediumFile or Folder Permissions Modifications by Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems)
Change ownership to the Administrator group instead of the current user
takeown /a /f path\to\fileIdentify/aGives ownership to the Administrators group instead of the current user. Windows commands reference/fSpecifies the file name or directory name pattern. Windows commands referenceTrips 1 Sigma rule: mediumFile or Folder Permissions Modifications by Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems)