Monday, December 15, 2014

grant administrators and change access to files and folders

 icacls "e:\program files" /grant administrators:F /t

 icacls "e:\program files" /grant {USERNAME}:{PERMISSION} /t


icacls <FileName> [/grant[:r] <Sid>:<Perm>[...]] [/deny <Sid>:<Perm>[...]] [/remove[:g|:d]] <Sid>[...]] [/t] [/c] [/l] [/q] [/setintegritylevel <Level>:<Policy>[...]]
icacls <Directory> [/substitute <SidOld> <SidNew> [...]] [/restore <ACLfile> [/c] [/l] [/q]]



____________________________________________________________________




Windows comes with a special command line utility called CACLS.
You can use it as follows:
CACLS files /e /p {USERNAME}:{PERMISSION}
Where,
  • /p : Set new permission
  • /e : Edit permission and kept old permission as it is i.e. edit ACL instead of replacing it.
  • {USERNAME} : Name of user
  • {PERMISSION} : Permission can be:
    • R - Read
    • W - Write
    • C - Change (write)
    • F - Full control
For example grant Rocky Full (F) control with following command (type at Windows command prompt):
C:> CACLS files /e /p rocky:f
Read complete help by typing following command:
C:> cacls /?

http://www.vistax64.com/vista-security/112670-changing-folder-permissions-recursively.html
http://www.cyberciti.biz/tips/windows-change-access-permissions-from-the-command-line.html

No comments:

Post a Comment