CHMOD (CHange MODe) is a popular command in Unix and Unix-like operating systems that allows you to change the access mode of a file via file permissions, attributes, and ownership.
Chmod Syntax in Linux looks like this:
When a Linux user tries to use Windows, they may require CHMOD at some point, and they may be looking for a Windows equivalent to Linux CHMOD. If you are also in this situation, Ourtechroom will assist you in locating Chmod in Windows.
Lets discuss Attrib and icacls command.
The icacls command, similar to Chmod, gives you the ability to set granular permissions in files and folders.
They give users the ability to view and modify an access control list (ACL) (Access Control List) for files and folders.
An access control list, or ACL, is a list that can be used by users or groups to grant permissions to an object in an NTFS file system.
Its general syntax looks like this:
Now let's look at how to change access permission to file and folder using ICACLS Command.
First create Folder DemoFolder and File demofile.txt.
echo > demofile.txt
Now let's create read-only permission for these folders and files.
icacls.exe DemoFolder /reset
icacls DemoFolder /inheritance:r
icacls DemoFolder /grant "everyone":R
It is always better to reset the permission before assigning.
Here, we are granting read-only permission to every user.
And when you try to delete the folder you will get the Folder Access Denied error as shown below.
Also for files, you can do as follows:
icacls.exe DemoFile.txt /reset
icacls DemoFile.txt /inheritance:r
icacls DemoFile.txt /grant "everyone":R
/reset will reset previously set permission.
/inheritance:r indicates removing all inherited ACEs.
/grant- adds a new ACE to the ACL that gives the special identity Everyone read-only access.
If you want recursively to every subfolder and subfiles then you can add "/t" as shown below:
icacls DemoFolder /grant "everyone":R /t
If you get an error and you want to ignore then you add "/c" as shown below:
Here, DemoFolder is already an existing folder and if there is a subfolder inside that folder then it works but if you want to apply this permission to every subfolder and file created in the future then you have to do the following things:
icacls DemoFolder /grant:r Everyone:(OI)(CI)W /t
Grant Readonly access to currently logged-in users.
This will only allow currently logged-in users to read only the file DemoFile.txt
Grant FullControl access to Users Groups
F gives Full Access to the file or folder.
Grant Modify Permission to Users Group
Where M stands for Modify
Set various permission
If you want to set various permission then you can do like this:
Here, in this way, we can set multiple permission for the folder or file for any user. In my case, I have used Everyone user and set Read Write permission to the folder DemoFolder.
Remove all access from Everyone User
Remove all access for everyone to the DemoFolder file.
icacls DemoFolder /inheritance:d /t /c
icacls DemoFolder /remove:g Everyone /t /c
First Command: Remove inheritance on the object
Second Command: Remove a user or group from the ACLs on an object
GUI equivalent to iCACLS Command
We can use GUI with the following command.
Right click on Folder/File you want to set Permissions like CHMOD
Security Tab Goto
Click on the Edit button
Permissions for Everyone, check on the first column check box if you want to provide access with the key described on the row and if you want to deny access then check on the second column checkbox. Then in the next screen Select Group and user name you want and then under
In my case, I have removed all the permission from the user Administrators (DIWAS\Administrators)
ATTRIB provides the basic functionality of CHMOD Attribute. This command's primary function is to remove and set file attributes (read-only, hidden, system, and archive), and as a result, it enables users to display, set, or remove the read-only, hidden, and archive file attributes that have been assigned to a file or folder. attrib.exe is solely responsible for modifying file attributes; it does not affect file permissions in any way.
Let's look at some of the examples:
Change Readonly attribute to File or Folder
Provide Hidden attribute to File or Folder
Clear all attributes to File or Folder
Minus sign is used to clear all the attributes like read-only, hidden, and archive file attribute to the file and folder.
Note that attrib has the following attributes:
|+s||Use it if you want to set a file or folder as a system file|
|-s||Use it if you want to remove a file or folder as a system file|
|+h||Use it if you want to make a file or folder invisible.|
|-h||Use it if you want to make a hidden file or folder visible|
|+r||Use it if you want to make a file or folder as read-only|
|-r||Use it if you want to remove the read-only property from the file or folder.|
In this way, we have successfully used the windows command equivalent to CHMOD.
You can use the help of icacls command. You can try the below command line by line.
Here I have applied CHMOD 400 for the DemoFile.txt file. If you want then you can change it to any file.
Note that if your file is in another path than your current command path then you have to provide the complete path of the folder/files instead of just the name. Example: you have to type like this: icacls.exe D:\Demofile.txt /reset where Demofile.txt is located in D drive.