Jump to content
Sign in to follow this  
dobbelina

Setting a folder permission

Recommended Posts

dobbelina

Hi again!

I'm trying to set permission for a folder, to full access

for Users with CACLS.

No matter what i do, it doesn't work?

#RequireAdmin
RunWait(@SystemDir & '\CACLS.EXE "' & @ProgramFilesDir & '\Xyplorer\Data"  /G USERS:F', @ProgramFilesDir & '\Xyplorer', @SW_HIDE)

If you run this via commandline there's a "Are you sure (Y/N)?"

prompt.

I guess this is the culprit.

Any solution for this ?

I have searched quite a bit here, and nobody seems to have

had this problem :idea:

Share this post


Link to post
Share on other sites
Fire

Hi dobbelina.

Yet i have this problem too.When i want to properly 'chmod' in win environment s ome files for Restricted users.

BTW solution:

I think you can use chmod.exe binary + required cygwin.dll files ( you need 2 dlls for run it in WIN OS properly)

ANd what is the cool all this files Opensource.

So if you want i can share all required files in here.

Or you can find all this required file from cygwin emulator.

It works for me cool.

Edited by Sh3llC043r

[size="5"] [/size]

Share this post


Link to post
Share on other sites
dobbelina

Sorry trancexx, didn't work.

Also if the system is a different language, Yes/No has another translation.

This is how i will use it,

To get the users group name (no matter what language), i will use something similar to this:

#RequireAdmin

$oWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$colItems = $oWMIService.ExecQuery("Select * From Win32_Group Where LocalAccount = TRUE And SID = 'S-1-5-32-545'")
For $oItem in $colItems
    
Next
$sUser= $oItem.Name
;code under this line is the problem ------------------

RunWait(@SystemDir & '\CACLS.EXE "' & @ProgramFilesDir & '\Xyplorer\Data"  /G ' & $sUser&':F', @ProgramFilesDir & '\Xyplorer', @SW_HIDE)

Then hopefully execute the cacls command somehow...

Share this post


Link to post
Share on other sites
FranckGr

If you need Admin rights, why don't use SubinACL ?

Share this post


Link to post
Share on other sites
trancexx

Sorry trancexx, didn't work.

Also if the system is a different language, Yes/No has another translation.

Ahh well. It works for me.

I would never use it though. And not for the same reasons.

If you want to avoid those kind of problems on different systems you won't consider running other programs for the job at all.

"Program" that uses other programs is less program and more something else.

DLLs are made for that. You have your own memory space and the whole system at our disposal. Use it the way it's meant to be used.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
dobbelina

Ahh well. It works for me.

I would never use it though. And not for the same reasons.

Ahh misstake by me.

Now it works. :idea:

I tested it via a ScITE editor that had been "thinapped".

After compiling it works beatifully.

I could get around the issue about language, concerning

the other than English (Y/N)prompt, by simply adding xcacls

instead.

It's exactly like cacls but it accepts a yes switch (/y)

It's a whopping 44 kb..

If you want to avoid those kind of problems on different systems you won't consider running other programs for the job at all.

"Program" that uses other programs is less program and more something else.

DLLs are made for that. You have your own memory space and the whole system at our disposal. Use it the way it's meant to be used.

I wouldn't even know where to start, learning/replicating what CACLS does via dll calls.

But if you give me a good hint, i'll be a good student.

I wish i had more knowledge about these things, so i didn't

have to ask you gurus to pull out a rabbit every now and then :)

At the moment, dll calls are like Hebrew written backwards,

chiseled out on a stone tablet by a drunk viking to me :(

By the way,thanks for all the help so far trancexx and others !

Edited by dobbelina

Share this post


Link to post
Share on other sites
dobbelina

After further examination i discovered that the XCACLS

tool is a little bit old and buggy.

Even though it works, it causes error messages to appear when

checking the security tab.

The best and final solution for me is to use ICACLS.

(The latest tool in the CACL series by MS)

  • It's small (26,5 kb)
  • It's fast (xcacls.vbs shitty slow)
  • It supports adding a Sid instead of user name = no language problem

This works beatifully without error messages:

#RequireAdmin
$programfiles = @ProgramFilesDir
RunWait($programfiles & "\Xyplorer\icacls.exe"  & ' "' & @ProgramFilesDir & '\Xyplorer\Data" /grant *S-1-5-32-545:(OI)(CI)F', "", @SW_HIDE)
Edited by dobbelina

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×