[[NTFS]] permissions can be adjusted using the following commands. # Taking ownership ```bash takeown /f "C:\\path\\to\\file" /a /r /d y ``` |Parameter|Description| |---|---| |/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\>.|| /a | Gives 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.| | /a | Gives 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.| |/r|Performs 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 permission on a specified directory, and instead uses the specified default value. Valid values for the /d option are:Y - Take ownership of the directory. N - Skip the directory. NOTEYou must use this option in conjunction with the /r option.| # Backup and restoring permissions ## ICACLS Backup ```bash icacls c:\\windows\\ /save AclFile /T /C /Q ``` icacls = command to run C:\windows\ = directory/file to run the command on /save = command to excute AclFile = where to save the ACLs /T  = Recurse the directory /C  = Continue even after a single failure /Q = Dont print information about successful files. ## ICACLS Restore ```bash icacls c:\\windows\\ /restore AclFile /T /C /Q ``` # Adjusting Permissions Grant full access to a user ```shell icacls D:\data\file.txt /grant domain\user:(OI)(CI)F ```