After reading the man page of getfacl
/ setfacl
I could not find an obvious/robust/elegant method to check whether acl is enabled for a given path in (ba)sh.
Any suggestions?
After reading the man page of getfacl
/ setfacl
I could not find an obvious/robust/elegant method to check whether acl is enabled for a given path in (ba)sh.
Any suggestions?
{
# Determine what the mount point for the path is:
MOUNT_POINT=$(df -P $FILENAME | tail -n 1 | awk '{print $6}')
# Get the mount options for the path:
MOUNT_OPTS=$(awk '$2=="'$MOUNT_POINT'" { print $4 }' /proc/mounts)
# Check to see if acl is one of the mount points:
echo $MOUNT_OPTS | tr , \\\n | grep '^acl$' -q
if [ $? -eq 0 ]; then
echo "ACLs enabled"
else
echo "ACLs disabled"
fi
}
© 2022 - 2024 — McMap. All rights reserved.
getfacl path;if [ $? -ne 0 ]; then echo "NO ACL"; fi
doesn't work? – Guiltygetfacl
indicates whether an acl is set or not. But not if the underlying filesystem has acl enabled. – Mirianmiriellew
access? can you create a temporary andsetfacl
it with something complex? – Linisaclgettypes /my/path/to/test
, but I haven't seen anything similar in other flavors. – Stumper