Why can't I remove a group from a file if it is being denied read permission even though I have read permission from my account, am part of the Administrators group, and I'm running icacls from an elevated command prompt?
This will remove the "Users" group just fine:
copy a b
icacls b /inheritance:d
icacls b /remove:g "Users"
Result: The file no longer has the "Users" group.
But if I remove read access then the group cannot be removed by icacls:
copy a b
icacls b /inheritance:d
icacls b /deny "Users":r
icacls b /remove:g "Users"
Result: The file still has the "Users" group.
To work around this I have to grant a group "full" permission first and then use /remove
to guarantee that the group will be removed. But this feels like a vulnerability as a particular group will, briefly, have full access.