Page 1 of 1

managing security on a folder after deployment

Published: February 28, 2017 - 11:36 AM
by gbt
Hello,
in a package I run a script at the end that should grant rights to a domain group on a directory of the deployed application.

My script, essai.bat, is:
icacls c:\temp\essai.txt /T /grant "adgroup@mydomain":f
icacls c:\temp\essai.txt /T /grant "everyone":r

The result: the "everyone" group is added, but not the domain group.

Manually running the script gives the expected result.

Thank you all.

Re: Managing security on a folder after deployment

Published: March 24, 2017 - 2:26 PM
by agauvrit
Good morning,

Is this script called by the setup.py file in the WAPT package?

Have you tried executing these lines directly in a run() command?

Code: Select all

run([makepath(WAPT.wapt_base_dir,'vc_redist','icacls.exe'),r'c:\temp\essai.txt','/T /grant "adgroup@mondomaine":f'])
run([makepath(WAPT.wapt_base_dir,'vc_redist','icacls.exe'),r'c:\temp\essai.txt','/T /grant "tout le monde":r'])
Sincerely,

Alexander

Re: Managing security on a folder after deployment

Published: May 9, 2017 - 8:23 AM
by gbt
Hi agauvrit,

the script is indeed called from setup.py.
Thank you for the tip about wapt's icacls: it works with a run. :D

Thanks for your help,
Olivier

Re: Managing security on a folder after deployment

Published: October 24, 2017 - 09:21
by gaelds
I've tried several different settings for icacls but I keep getting a "returned non-zero exit status 87" error
What settings are needed to grant access to a folder to all users or everyone?

Code: Select all

 run([makepath(WAPT.wapt_base_dir,'vc_redist','icacls.exe'),r'C:\Program Files\SolidWorks Corp','/grant *S-1-1-0:(OI)(CI)M /C /T'])
CalledProcessErrorOutput: Command ['C:\\wapt\\vc_redist\\icacls.exe', 'C:\\Program Files\\SolidWorks Corp', '/grant *S-1-1-0:(OI)(CI)M /C /T'] returned non-zero exit status 87.
Output:u'Param\xe8be invalid \xab\xa0/grant *S-1-1-0:(OI)(CI)M /C /T\xa0\xbb\r\r\n'


The control operates manually.

Re: Managing security on a folder after deployment

Published: October 24, 2017 - 2:54 PM
by agauvrit
Good morning,

Slashes in arguments are interpreted differently; try putting an 'r' in front of the argument list:

Code: Select all

run(makepath(WAPT.wapt_base_dir,'vc_redist','icacls.exe'),r'C:\Program Files\SolidWorks Corp',r'/grant *S-1-1-0:(OI)(CI)M /C /T')
Sincerely,

Alexander

Re: Managing security on a folder after deployment

Published: November 6, 2017 - 10:12 AM
by gaelds
So I'm getting a new error message: TypeError: unsupported operand type(s) for +: 'float' and 'str'

with this command:

Code: Select all

run(makepath(WAPT.wapt_base_dir,'vc_redist','icacls.exe'),r'C:\Program Files\SolidWorks Corp',r'/grant *S-1-1-0:(OI)(CI)M /C /T')

Re: Managing security on a folder after deployment

Published: January 9, 2018 - 11:13 AM
by gaelds
Sorry, but I'm still stuck using icacls with wapt. On another package where I want to give all users permissions to a directory, I get the following message:
TypeError: unsupported operand type(s) for +: 'float' and 'str'
for the following code:
run(makepath(WAPT.wapt_base_dir,'vc_redist','icacls.exe'),r'%s' %destdir,r'/grant *S-1-1-0:(OI)(CI)M /C /T')

The equivalent command launched manually works:

Code: Select all

C:\wapt\vc_redist\icacls.exe C:\ProFluid44 /grant *S-1-1-0:(OI)(CI)M /C /T