mkdir - do not inherit permissions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ezechiel
    New Member
    • Jul 2009
    • 53

    mkdir - do not inherit permissions

    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
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by ezechiel
    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

    Comment

    • ezechiel
      New Member
      • Jul 2009
      • 53

      #3
      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:
      Code:
      /I REMOVE
      This will uncheck the "inherit from parent folder" checkbox and remove inherited access rights.

      Hope this will be usefull to others too..

      Comment

      Working...