Related Items  

Linux and Windows Support  

make-it-great-again

Login or Register  

If you wish to contribute an article, please login or register.

Change access permissions in command prompt

PrintE-mail

Q. Command-Prompt-iconI'm logged in as a non-privileged user and would like to change file permissions. How do I do that without logging out?

A. 1. First you have to open the command prompt as a privileged user. That can be found under Start -> "All Programs" -> Accessories. Right-click on the "Command prompt" icon and select "Run-As".

2. Once prompted, enter username and password.

3. On the command line, you can use a comman called CACLS. Here's the full list of things that it can do:

Displays or modifies access control lists (ACLs) of files
CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
               [/P user:perm [...]] [/D user [...]]
   filename      Displays ACLs.
   /T            Changes ACLs of specified files in
                 the current directory and all subdirectories.
   /E            Edit ACL instead of replacing it.
   /C            Continue on access denied errors.
   /G user:perm  Grant specified user access rights.
                 Perm can be: R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /R user       Revoke specified user's access rights (only valid with /E).
   /P user:perm  Replace specified user's access rights.
                 Perm can be: N  None
                              R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /D user       Deny specified user access.
Wildcards can be used to specify more that one file in a command.
You can specify more than one user in a command.

Abbreviations:
   CI - Container Inherit.
        The ACE will be inherited by directories.
   OI - Object Inherit.
        The ACE will be inherited by files.
   IO - Inherit Only.
        The ACE does not apply to the current file/directory.

So if you want to add permissions to a folder called "Shared", located on C: drive for Everyone, do the following:

C:\cacls c:\Shared /e /p Everyone:f

Where /e is to preserve old permissions;
/p is to add new permissions;
Everyone is the user
f stands for Full Control (R Read, W Write, C Change (write), F Full control)

If you don't include /e, the permissions assigned will be the only permissions on the file/directory.

 

Comments (4)
how to set ile permissions in windows file
4 Friday, 03 March 2017 08:34
vamsi
hiii
admin access
3 Thursday, 09 February 2017 01:17
ishwar
how can do edit acl info h=and how to use in cmd
please...
admin access
2 Thursday, 09 February 2017 01:11
ishwar
even give a full control access folder administrator but
its also showing Access Denied. i edited user group control also ...
i have only one user account ...it my old account file, i changed user control also.
please help me ....
VBS script to change ACL
1 Thursday, 20 September 2012 10:22
G222
There is a very powerful script xcacls.vbs that changes/edits ACL info and can be incorporated into a batch file or run from the command prompt. Best if run by cscript. Enter cscript xcacls.vbs help for a full list of sitches and options.

Add your comment

Your name:
Subject:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
yvComment v.1.24.0
   
Copyright © 1999 - 2017 Virtual Helpme | r | Original Template: Allrounder