Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve Default ACL in Python Using Posix 1e

Tags:

python

acl

Using the posix 1e Python module I am able to get/set the ACL for a file without having to spawn a subprocess and call getfacl/setfacl:

>>> import posix1e
>>> acl1 = posix1e.ACL(file="file.txt") 
>>> print acl1
user::rw-
group::rw-
other::r--

I can also apply a default ACL and delete it:

path = '/some/other/path/'
acl1.applyto(path, posix1e.ACL_TYPE_DEFAULT)
posix1e.delete_default(path)

However, I can not seem to work out how to retrieve the default ACL! Does anyone know how this can be done using the posix 1e module?

like image 771
JimmidyJoo Avatar asked Aug 24 '26 21:08

JimmidyJoo


1 Answers

Turns out there is a way to do this:

default_acl1 = posix1e.ACL(filedef="/some/other/path/") 
like image 54
JimmidyJoo Avatar answered Aug 26 '26 10:08

JimmidyJoo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!