[EMAIL PROTECTED] wrote: > Is there a standard library module in Python 2.4 (Win32) that will > return directory permissions / ACLs (e.g. users, groups, and what > rights they have)? > > Otherwise, I'm faced with sending "cacls dirName" commands via os.popen > as below, and then parsing and comparing the text output. > > Basically, I'd like to compare what the ACLs a directory should have > against what the actual ACLs are. > > Here's what I started with: > > import os # Cross-platform filesystem manipulation > > rootDir = "S:\someRootDirectoryHere" > > print "*** Printing DIRECTORY names beneath directory " + rootDir + " > ***\n" > for dirpath, dirnames, filenames in os.walk(rootDir): > for dirNm in dirnames: > theDirPath = os.path.join(dirpath, dirNm) > print '"' + theDirPath +'"' > # cacls needs double-quotes around space-containing paths > result = os.popen("cacls " + '"' + theDirPath + '"') > # Print the security info (ACLs)for specified directory > print result.read() > > Thanks.
The win32security module from Pywin32 wraps the functions used to read and change security descriptors. Roger ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =--- -- http://mail.python.org/mailman/listinfo/python-list