Skip to content

What is CACLS Windows command?

The cacls (Change Access Control Lists) command in Windows allows users to manage file permissions and security settings for files and directories. By using cacls, users can display the current ACLs (Access Control Lists) for a specific file or directory, as well as modify or replace them as needed. This command is useful for system administrators and IT professionals who need to set specific permissions for different users or groups on a Windows system. With cacls, users can grant or revoke permissions such as read, write, and execute for individual users or groups, providing a higher level of security and control over files and directories.

CACLS Syntax:

Terminal window
cacls [FileName] [/T] [/E] [/C] [/G User:Permission] [/R User] [/P User:Permission] [/D User]

CACLS Options:

OptionDescription
/TChanges the ACLs of specified files in the current directory and all subdirectories.
/EEdit the ACL instead of replacing it.
/CContinue even if errors occur.
/G User:Permission Grant specified user access rights.
/R UserRemove specified user’s access rights.
/P User:Permission Replace specified user’s access rights with the ones provided.
/D UserDeny specified user access rights.

Parameters:

ParameterDescription
FileNameSpecifies the file or directory to display or modify access control lists.

CACLS Command Usage Examples:

Grant Read Permissions to a User

Terminal window
cacls C:\ExampleFolder /e /t /g Users:R

Grants the “Users” group read permissions for the directory “C:\ExampleFolder” and all its subdirectories.

Revoke Write Permissions from a Specific User

Terminal window
cacls D:\Confidential /e /p John:D

Revokes write permissions from the user “John” for the “D:\Confidential” directory.

Display Permissions for a File

Terminal window
cacls E:\ImportantFile.txt

Displays the current permissions set for the file “E:\ImportantFile.txt”.

Add Full Control Permissions for Administrator

Terminal window
cacls F:\SystemFiles /e /g Administrators:F

Adds full control permissions for the “Administrators” group to the “F:\SystemFiles” directory.

Remove Inheritance from a Directory

Terminal window
cacls G:\SharedFolder /e /c /g Users:P

Removes inherited permissions for the “Users” group from the directory “G:\SharedFolder”.

How do I use cacls in CMD?

To use the cacls command in CMD, execute the following command:

Terminal window
cacls C:\example.txt /E /G myusername:F

What is the cacls command used for?

The cacls command in CMD is used to display or modify Access Control Lists (ACLs) for files and folders.

How can I grant permission to a specific user with cacls?

To grant permission to a specific user, you can use the cacls command with the /G option followed by the username and the desired permission level. For example:

Terminal window
cacls C:\example.txt /G myusername:F

How do I deny access to a specific user with cacls?

To deny access to a specific user, you can use the cacls command with the /D option followed by the username. For example:

Terminal window
cacls C:\example.txt /D myusername

Can I edit multiple files at once with cacls?

Yes, you can edit permissions for multiple files at once by specifying the files or directories in the cacls command. For example:

Terminal window
cacls C:\example1.txt C:\example2.txt /E /G myusername:F

How do I view the current permissions of a file with cacls?

To view the current permissions of a file, you can simply run the cacls command followed by the file path. For example:

Terminal window
cacls C:\example.txt

Is it possible to recursively change permissions for all files in a directory with cacls?

Yes, you can recursively change permissions for all files in a directory by using the /T option in the cacls command. For example:

Terminal window
cacls C:\example\* /E /G myusername:F /T

How do I remove all permissions for a user with cacls?

To remove all permissions for a user, you can use the cacls command with the /R option followed by the username. For example:

Terminal window
cacls C:\example.txt /R myusername

Applications of the CACLS Command

  • Grant permissions to files and directories
  • Revoke permissions from files and directories
  • Display permissions of files and directories
  • Change ownership of files and directories
  • Copy permissions from one file or directory to another