Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

April 25, 2007 12:00 AM

Icacls: The New and Improved Cacls?

The tool does more, lacks something important, but generally impresses
Windows IT Pro
InstantDoc ID #95346
Rating: (3)

As every Windows administrator knows, NTFS permissions are some of our most useful weapons in the battle to keep our systems secure. In some cases, the Folder Options' Security tab offers an easy way to make minor permissions tweaks, but for repeatable or more complex jobs, the command line has always offered the most powerful tools, and in this case, the best one for the job has been Cacls—short for change access control list. However, Cacls has a few blind spots—for example, it's difficult to set permissions on a folder so that they're inherited. Because of these flaws, Microsoft might not include it in future Windows versions (although the tool is still around in Windows Vista).

Microsoft isn't leaving us out in the cold, though: Vista offers another permissions-focused command-line tool called Icacls. Just as Cacls does, Icacls lets you add or remove permissions, and at first glance Icacls appears to be a complete Cacls replacement. But it's not—it does a few things that Cacls can't do, and it lacks one extremely useful Cacls feature: You can't use it to hand-code a Security Descriptor Definition Language (SDDL) string. But in general, you'll find that Icacls improves upon Cacls.

How It Works
Icacls shows you a file's or folder's explicit and inherited file permissions, albeit in a somewhat encoded format. For example, if I create a file named test.txt, use the GUI to add an explicit Full Control permission for myself, and type

icacls test.txt 

I'll get the output that Figure 1 shows.

The first permission—vbus32\Mark:(F)—shows that a local account named Mark has Full Control permissions on the vbus32 system. (F is Icacls shorthand for Full Control, as it is for Cacls.) The next permission refers to the System account, but notice that its permission contains not only an F but also an I. The I tells you that System inherited the Full Control permission. Interestingly, there's no code for explicit permissions—only for inherited permissions. Icacls has many other codes, but let me highlight two more codes in Figure 1's example: M is the Modify permission, and RX comprises the Read and Execute permissions.

You can use the /grant option to give a file or folder a permission. In its simplest form, it looks like

icacls <file or folder name> /grant <useraccount>:  
  <permission> 

So, to give an account named Joe the power to delete test. txt, I could type

icacls test.txt /grant joe:d 

(Incidentally, case doesn't matter. I could also have typed JOE:D, Joe:D, or joe:D.)

Note that when you use Cacls to grant a permission, you also (by default) remove all previously existing permissions, including the inherited ones! You can fix that by adding the /E option to Cacls, but I've forgotten /E often enough to welcome Icacls' new syntax. In short, Icacls doesn't first remove all existing permissions before granting a new one. If, however, you want Icacls to first remove any permissions that a given user has before granting a new one, you can replace /grant with /grant:r. For example, if I were to give Joe the Modify permission by typing

icacls test.txt /grant joe:m 

and then give him Read and Execute permissions by typing

icacls test.txt /grant joe:rx 

then the command Icacls Test.txt would show me only Joe's Modify permission, because the Modify permission includes Read and Execute. But if I were to instead type

icacls test.txt /grant:r joe:rx 

Joe would have only Read and Execute.

You can use the /remove option to remove any explicit permission. (Icacls seems unable to remove inherited permissions.) To remove all of Joe's permissions, I'd type

icacls test.txt /remove joe

What's the "I" For?
I'm not quite sure what the "I" in Icacls stands for. Perhaps it means "inheritable" because the tool fixes the aforementioned Cacls problem, or maybe it means "integrity" because it lets you control Vista's integrity levels. Or maybe Icacls is just the Apple version of Cacls! Regardless, Icacls is a useful Cacls successor, but there's much more to it, as you'll see next month.

Related Content:

ARTICLE TOOLS

Comments
  • MARK
    5 years ago
    Aug 19, 2007

    No, but you CAN block inheritance from the GUI and you could from Cacls, but icacls seems unable to do that.

  • Duncan
    5 years ago
    Jun 08, 2007

    "Icacls seems unable to remove inherited permissions" - individual inherited permissions cannot be removed via the GUI either (at least on XP & 2003). You can however choose not to inherit any permissions at all via the GUI - is this possible with Icacls? (I don't yet have a copy of Vista to play with)

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

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