win32security

benflynn1 at my-deja.com benflynn1 at my-deja.com
Fri Feb 18 10:27:53 EST 2000


I am currently trying to modify the permissions of 2500 directorys on a
server to take them from Everyone full control to Administrator / a
specific user full control.  I am relatively new to python and the
closest I have got to achieving this objective is the following :

#!/usr/local/bin/python

from win32security import *
from ntsecuritycon import *
from win32con import *

sid,domain,z = LookupAccountName('\\\\server','userid')
newACL=ACL()
oldsecurity=GetFileSecurity('c:\\test',DACL_SECURITY_INFORMATION)
newACL.AddAccessAllowedAce(GENERIC_ALL , sid)
oldsecurity.SetDacl(1, newACL, 0)
SetFileSecurity('c:\\test',DACL_SECURITY_INFORMATION,oldsecurity)

Can anybody help me with this as the above code won't work - fails on
SetFileSecurity.  Any help would be much appreciated.



Ben.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list