Modify file and directory permissions on Windows Server

Have you ever needed to change or add permissions to a large number of files and/or folder?  Well you can use the powerful  Subinacl to modify file and directory permissions.  The utility is part of the Microsoft Windows Server Resource Kit

For example if I need to grant access to my account for a bunch of folders and files on Server1Home then I would run the following:

C:Program FilesWindows Resource KitsTools>subinacl /subdirec \Server1Home*.* /grant=domainsteve

This command will go in and add in my “steve” account for all files and folders under the Home directory

Here is the syntax. From MS KB

SUBINACL /SERVICE \MachineNameServiceName /GRANT=[DomainName]UserName[=Access]

Notes

The user executing this command must have administrator rights in order for it to complete successfully.

If “MachineName” is omitted, the local machine is assumed.

If “DomainName” is omitted, the local machine is searched for the account.

Although the syntax example indicates a user name, this will work for user groups as well.

The values that ‘Access’ can take are:

 F : Full Control R : Generic Read W : Generic Write X : Generic eXecute L : Read controL

If ‘Access’ is omitted then ‘F (Full Control)’ is assumed.

Subinacl supports similar functionality in relation to files, folders, and registry keys. Refer to the Windows 2000 Resource Kit for more information.

The service name should be the “short name,” as used for the service-specific key in the registry:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices<ServiceName> If the service name contains spaces, the whole parameter should be enclosed in quotation marks. For example: \MachineNameService Name With Spaces