Connecting Tech Pros Worldwide Forums | Help | Site Map

mkdir - do not inherit permissions

Member
 
Join Date: Jul 2009
Posts: 48
#1: Aug 13 '09
Hi,

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)..?

numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,571
#2: Aug 13 '09

re: mkdir - do not inherit permissions


Quote:

Originally Posted by ezechiel View Post

Hi,

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)..?

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.

Regards,

Jeff
Member
 
Join Date: Jul 2009
Posts: 48
#3: Aug 14 '09

re: mkdir - do not inherit permissions


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..
Reply


Similar Perl bytes