3

At my work we recently made the move from XP to Windows 7, and as a developer, it's been a nightmare. I develop for embedded system, so our build process might be a little bit different. Our build process is extremely complicated, and generates a lot of copies of files, which need to be moved and copied around. The problem is that a built will often fail because it does not have permission to copy a file over.

On my entire build directory I would run

takeown /F * /R /D Y
icacls . /T /Grant <userid>:F

From the root build directory, but I still have issues copying files (cannot create regular file 'bla.bla': Permission denied). So I am forced to manually touch the file, set the mode to +www, and build again.

My question is if there is a simple way to get a tree of directories so that any user/application can create/modify all files within it. icacls doesn't seem to cut it.

EDIT: Extra information: Windows x64, GNU make, using a bat file to set environmental variables before calling make

2 Answers 2

2

Locate the build directory in the graphical Windows Explorer, right-click on it, and select Properties. Go to the Security tab, and click the Advanced button, and then in the window that appears, click the Advanced button. If Include inheritable permissions from this object's parent is checked, uncheck it. Choose Remove in the warning dialog box that appears. If any ACLs remain in the Permission entries box, delete them.

Now, select Add, enter your username, click OK. Then, a dialog box that lets you select permissions for that user appears. Check the Full Control box under Grant and click OK. Repeat for other user accounts or groups that need access to the directory, if any. Also, add Full Control for the Administrators group and the built-in SYSTEM user just in case. If the directory is on your local machine and only you can log on to it, you might want to just give the Everyone group full control instead, to be absolutely certain things will work.

Next, select the Replace all child object permissions with inheritable permissions from this object. The dialog box should now look something like this:

Windows advanced security dialog

Finally, click OK, and choose Yes to verify that you'd like to overwrite the permission of all files and subdirectories in that directory. That will replace whatever alphabet soup of permissions you have going on with permissions that match exactly what you just applied to the build directory itself. Furthermore, changes to the build directory's permissions will automatically propagate to all files below them now, so you need only change the permissions of the build directory in the future, rather than doing so recursively throughout the directory.

1
  • Other than some minor issues with perforce (expecting non checked out files to be RO) this did the trick. -- Thank you!
    – Gdogg
    Jun 2, 2011 at 15:27
0

For a start, I would run the tool you are using to build/move as an administrator, that should fix many of the issues. In addition, when you say that ICacls does not seem to cut it, does it fail to give you the rights, or does it give you the rights, but you are still having issues?

2
  • I still have the issues, but it seems to run properly. It just seems like new files aren't created with any permissions, when I'd like them to be created with the permissions of their parent directory. I'm executing the script as a user with administrative privileges, using windows powershell (or cmd.exe*32). How can I run it as an admin (from the command line?)
    – Gdogg
    Jun 1, 2011 at 20:39
  • In the folder settings, set it so that all files created in the folder inherit the permissions (the other answer has a nice graphic).
    – soandos
    Jun 1, 2011 at 20:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .