Subscribe to Windows IT Pro
November 25, 2002 12:00 AM

Control ACEs and ACLs with Subinacl

More on what this handy tool can do for you
Windows IT Pro
InstantDoc ID #27098
Rating: (2)

The syntax for the /changedomain parameter is

subinacl [object] /changedomain=
olddomainname=newdomainname

where object is the type and name of the item for which you want to change the ACEs and olddomainname and newdomainname are the names of the old and new domains, respectively. Recall from the October column that the object type can be a file (/file), subdirectory (/subdirectory), registry key (/keyreg), share (/share), or other value. So, for example, to examine every file and folder on the C drive and change any SIDs from the ENGINEERING domain to their corresponding SIDs on the ALLOFUS domain, you use the command

subinacl /subdirectories c:\* /changedomain=engineering=allofus

The /migratedomain parameter has the same syntax and behavior as /changedomain, with one exception: Instead of replacing ACEs that refer to the old domain with ACEs that refer to the new domain, the /migratedomain option supplements ACEs that refer to the old domain with ACEs that refer to the new domain. In other words, if an old domain account has full-control access to a folder and you run the /changedomain option, the old domain account doesn't have access to that folder any more. Only the new domain account has full-control access. But if you run the /migratedomain option, both the old domain account and the new domain account have full-control access to the folder.

Testing Access
You can use Subinacl to make sure that the user accounts in a newly migrated master domain have access to resources in the old domains. The Subinacl command's /accesscheck parameter lets you test access. This parameter answers the question, "Can person X access object Y?"

The syntax for the /accesscheck parameter is

subinacl [object] /accesscheck=
domainname\username

where object is the type and name of the item to which you're checking access, domainname is the name of the user's domain, and username is the name of the user. So, for example, to determine whether Mary can access the C:\testit.txt file from her account in the ALLOFUS domain, you run the command

subinacl /file c:\testit.txt /accesscheck=allofus\mary

Subinacl then asks you for Mary's password. How do you get your hands on Mary's password? Remember that the /accesscheck option is a postmigration test tool. If you used a program such as addusers.exe to migrate user accounts, you assigned a temporary password, which the users will change when they log on for the first time after the migration. But until Mary logs on, you'll know her new account's password.

Backing Up and Restoring ACLs
I saved one of the best options for last: ACL backup and restore. The Subinacl command's /noverbose and /output parameters let you take a snapshot of the ACL on an object or group of objects, and the /playfile option lets you restore the ACL. The syntax for the /output parameter is

subinacl /noverbose /output=filename subinacl command

where subinacl command is a set of Subinacl object types and actions—basically any Subinacl command that you've seen in this column or the October column. So, for example, to back up the NTFS ACLs on all the files in the root directory of the C drive to a file called C:\aclbackups.txt, you use the command

subinacl /noverbose /output=
c:\aclbackups.txt /file c:\*

If you run this command without the /output parameter, you'll see that it just reports on (but doesn't store) the ACLs. The /output parameter prompts Subinacl to store the output to a file.

To reapply a file's ACLs and wipe out any ACL changes that you've made since the backup, you use the /playfile option. Just invoke the Subinacl command with the /playfile parameter followed by the name of the backup file. For example, the command

subinacl /playfile c:\aclbackups.txt

fully restores the NTFS ACLs on all the files in the C drive's root directory.

Don't Kick Yourself Later
The more I use Subinacl, the more I find use for it—and the more I kick myself for not having learned it earlier. Learn from my experience and start using Subinacl now.

Related Content:

ARTICLE TOOLS

Comments
  • prince
    5 years ago
    May 10, 2007

    Hi All,

    Im trying to backup/restore ACL prmissions for the windows NTFS files/folders. i decided to use subinacl tool.

    i successfully backed up the ACL permissions using the command : subinacl.exe /outputlog="test.log" /file test.txt.

    When i try to restore the ACL permisions using the command :subinacl.exe /playfile test.log.

    But no luck. when i check the test.txt file's security information, notthing is availabale. there is no users/groups and permissions. its just cleaned all the informations and also i couldnt open the file. im wondering is ther any thing i have to do ?

    here is some output of /playfile command:

    C:\\Program Files\\Windows Resource Kits\\Tools>subinacl.exe /playfile test.log

    WARNING : /pace =builtin\\administrators access_allowed_ace_type-0x0 : Invalid option : test.txt
    WARNING : /pace =system access_allowed_ace_type-0x0 : Invalid option : test.txt
    WARNING : /pace =\\administrator access_allowed_ace_type-0x0 : Invalid option : test.txt
    WARNING : /pace =builtin\\users access_allowed_ace_type-0x0 : Invalid option : test.txt
    test.txt : \\administrator is the new owner
    test.txt : \\none is the new Primary Group
    test.txt : 3 change(s)


    Elapsed Time: 00 00:00:00
    Done: 1, Modified 1, Failed 0, Syntax errors 4
    Last Done : test.txt
    Last Syntax Error:WARNING : /pace =builtin\\users access_allowed_ace_type-0x0 : Invalid option :test.txt

    i dont know why its failed with invalid option. i loggin in as administrator only. i need your help urgently.

    any help would be appriciated . thanks in advance.

    -prince

  • Anonymous User
    7 years ago
    Jan 05, 2005

    How to you use this tool to clean away orphan SID from the NTFS file.

  • davidponak
    8 years ago
    Jul 29, 2004

    look for the newest version of subinacl - fixes the ordering issue.. Anyone know what syntax would record just the ACL's of all Subfolders (not files)

  • Jennifer
    8 years ago
    May 17, 2004

    I have successfully used this tool to replace ACL's. I am in deparate need for a tool that will add an ACL based on an existing ACL. Such as the replace command but ADD.

    Is there such a tool for this?

  • Federico Parra
    8 years ago
    Jan 26, 2004

    Hi,
    This is a very usefull tool, but I have a question I made some test to backup the ACL´s but if I have a big file structure (3 or 4 folders levels) only the root level is backep up. Do you have any tip for this?????
    From Venezuela
    Thanks,

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.