2

I am running a batch file as part of a larger application. If certain conditions are met, a folder is created and permissions applied to the folder using icacls.

I have permission inheritance disabled on the parent folder, and I want to add to the ACL full permissions for the user "testuser".

I tried the following command...

 icacls "V:\debugging\test" /grant testuser:F

The command completes successfully, however when logging in to the folder via CIFS, I do not have full permissions.

I can create files and folders but not modify them. I cannot even rename a text file during creation, so I end up with a new file called 'New text document' and i have no permission to edit this.

What I need to happen is for the permissions to be applied to "V:\debugging\test" that allow me to read, modify and and write without exception and If possible I need those permissions to be inherited by any child folders that may be created.

Can anyone point me in the right direction?

John
  • 755
  • 1
  • 18
  • 46
  • 1
    You probably need `/grant testuser:(OI)(CI)(F)` – Harry Johnston Aug 03 '16 at 02:32
  • @HarryJohnston: I was facing a similar issue and your solution worked. Any idea what is the difference? – Ravindranath Barathy Aug 23 '16 at 14:17
  • @Curious: `F` grants the user access to the folder, but not to files or folders contained in the folder. The `(OI)` option says that the permission should be inherited by files. The `(CI)` option says that the permission should be inherited by sub-directories. Without them, the default is no inheritance. (Also, you can add `(IO)` if you want the permission to apply *only* to files and sub-directories but not to the directory itself.) – Harry Johnston Aug 23 '16 at 21:02
  • FYI: I just spent ages trying to track down a similar issue to find there wasn't an issue. When running `icacls "\\some\path"` to check permissions, the first permission is output on the same line as the path. If the path takes up the width of your command window, you won't see it. You can increase the width by right clicking the title bar, select layout, amend screen buffer size's width and window size width to larger values. Now rerun your command and you'll see the right output. Hope this helps others / provides some amusement :/ – JohnLBevan Apr 25 '20 at 10:42

0 Answers0