Is there any Windows equivalent of Linux's chmod to change the permissions of a file?

link|improve this question
feedback

migrated from stackoverflow.com Feb 8 '10 at 10:32

This question came from our site for professional and enthusiast programmers.

4 Answers

Either cacls, xcacls, or my personal favourite icacls will probably do what you need.

link|improve this answer
I believe icacls is only available on Vista/7. – Hello71 Aug 15 '10 at 16:01
feedback

Greg mentions attrib - but attrib isn't anywhere close to chmod - atrrib can set Read-only/Hidden attributes of a single file - it doesn't provide fine-grained controls like icacls does.

icacls sets/resets the access control lists, so you can grant/deny rights for individual SIDs & groups. It is fairly complicated though.

Here's an example I have saved in my github gist; it resets the ownership and access control list for all files in a folder and is particularly useful to fix those annoying "You need permissions from .. to perform this action" especially when moving files over from a previous install:

icacls * /reset /t /c /q 

Reset replaces the existing one with the default list.
/t acts recursively on all files, folders & subfolders
/q doesn't display any success messages
/c continues with remaining files even in an error occurs.

You can also do things like backup the existing ACLs & apply them across all. Have a look at ss64 which explains the different options & switches very well.

link|improve this answer
feedback

The attrib command is the closest match for very basic things (read-only, archive flags). Then there is The ACL (access control list) command cacls. Last but not least, since Windows is actually Posix compliant, the unix-like flags do exist. If you install the Cygwin tool set, you will get a chmod. (A little off-topic, since you are looking for an equivalent of a unix command, downloading and installing Cgygwin might be something interesting for you.)

link|improve this answer
feedback

There is nothing called chmod in windows because the security model of Windows is different than Linux. You can use attrib command to change the properties of the objects. (But they are more towards global properties.)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown