Recursively add permissions to a users home folder with icacls

Having issues with long file paths also when trying to set permissions? Check out this guide on how to find long paths and correct them.

First you’re most likely going to need to take ownership of the data before you will be able to set the perms, my preferred method is to use takeown.

takeown /F ROOT_FOLDER /A /R /D /Y

/F           filename        Specifies the filename or directory
                             name pattern. Wildcard "*" can be used
                             to specify the pattern. Allows

/A                           Gives ownership to the administrators
                             group instead of the current user.

/R                           Recurse: instructs tool to operate on
                             files in specified directory and all

/D           prompt          Default answer used when the current user
                             does not have the "list folder" permission
                             on a directory.  This occurs while operating
                             recursively (/R) on sub-directories. Valid
                             values "Y" to take ownership or "N" to skip.

Once you have taken control you can then set the perms with the below.

icacls ROOT_FOLDER /grant DOMAIN\USER:F /t

If you found this article helpful, would you consider buying me a Coffee?