By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,177 Members | 976 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,177 IT Pros & Developers. It's quick & easy.

mkdir - do not inherit permissions

P: 53

I'm working on windows here..
i have a script that makes directories, subdirs (mkdir) and I afterwards set special permissions with xcacls trough a system call.

But when I took a closer look at the advanced security permissions, I saw that mkdir makes permission inheritance, when creating the subdirectories:

main dir is ok, but sub dir permissions:
Inherited From: permissions inherited by [main dir]

And I don't want that to happen.
Anyone knows how to do this?? Would using system(mkdir ...) avoid this? Or is there a perl solution (I would prefer)..?
Aug 13 '09 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 3,503
That would be an issue with the windows mkdir command, since you are using the system() function. Have you tried using Perl's built in mkdir function? You can set permission through it, but I don't know if that will work since they are Unix type permissions. You can test it though and see. Otherwise, you might have to modify permissions, unless the windows mkdir command has options you can feed it.


Aug 13 '09 #2

P: 53
Well, I tried with system(mkdir .. ) and with perl command mkdir..
Both have the same result.

But I found the solution and it is really simple in fact..
(why didn't I thought of it before.. sigh)

Just use xcacls and put the following parameter:
Expand|Select|Wrap|Line Numbers
  1. /I REMOVE
This will uncheck the "inherit from parent folder" checkbox and remove inherited access rights.

Hope this will be usefull to others too..
Aug 14 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.