I know that I can use icacls to specify the permission on the file, and from What is the equivalent of chmod 777?, I can use
icacls myfile.txt /grant Everyone:F
But how do I set an equivalent for chmod 744? I think I can use /grant:____:R
for just read access, but I'm not sure how to specify the owners and the group permissions as simply as with chmod. When I try this:
icacls myfile.txt /grant Owner:F Group:R Everyone:R
I receive an error, "No mapping between account names and security IDs was done." I'm probably missing something obvious, any ideas?
When I try:
icacls myfile.txt /grant Administrator:F /grant:r Users:R
I take a look at the file in Explorer and it has given Administrator "Special Permissions" (rather than Full Control) and gives Users "Read & execute, Read, and Special Permissions."
Best Answer
Give this a shot and see if this does what you're trying to accomplish. I always run these explicitly so one for setting the
Owner
, one forFull Control
, one forRead-only
, and one forRead and Execute
.This way you can do it for a specific file and for a specific user or group where applicable. Just plug in your file names, etc.
Sample ICACLS commands to set owner, grant full control, read-only, and read plus execute access (You may need to run the command prompt as administrator with these commands)