CheatSheet of useful CMD commands for Windows Server to folder and files permissions like chmod and chown. (continually updated)
Take ownership of whole content folder and sub files/dirs:
- takeown – Enables an administrator to recover access to a file that previously was denied, by making the administrator the owner of the file.
- icacls -Displays or modifies discretionary access control lists (DACLs) on specified files, and applies stored DACLs to files in specified directories.
takeown /f "C:folder" /r /d y icacls "C:folder" /grant logged_user:F /t /q
Where:
takeown: /f = <Folder name>; /r = recursive; /d y = take ownership of the dir icacls: <Folder name>; /grant = <Username>:R, W, F (full control); /t = apply for all files and subdirs; /q = show status messages