ACL_DELETE_PERM(3)

πŸ“¦
version 2.4.0 Β· 3 versions
, in arch rolling, centos-stream 10, centos-stream 9, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu stonking

πŸ’– ACL_DELETE_PERM πŸ’–

okay bestie, so this is acl_delete_perm(3) from the Library Functions Manual, and it's literally the "un-adding" button for ACL permissions. it's giving ✨subtraction✨


πŸŽ€ NAME πŸŽ€

acl_delete_perm β€” delete a permission from an ACL permission set

no cap, that's the whole job. bye bye permission πŸ’…


πŸ“š LIBRARY πŸ“š

Linux Access Control Lists library (libacl, -lacl).

so when you're linking, you want that -lacl on the line, okurrr 🫢


✨ SYNOPSIS ✨

#include <sys/types.h>
#include <sys/acl.h>

int
acl_delete_perm(acl_permset_t permset_d, acl_perm_t perm);

two includes, one function, iconic behavior honestly πŸ‘‘


🌸 DESCRIPTION 🌸

so the way that acl_delete_perm() works is it deletes the permission contained in the argument perm from the permission set that permset_d is pointing at. and perm is one of ACL_READ, ACL_WRITE, ACL_EXECUTE β€” those are the three flavors, pick your fighter πŸ₯Š

and here's the chill part: if you try to delete a permission that isn't even in there? that is not considered an error. the function just shrugs, says "already not there bestie", and moves on. no drama, no errno, nothing. we love a low-stakes queen πŸ¦‹

also, any existing descriptors that refer to permset_d continue to refer to that permission set. like, they're still holding hands with the same set. the deletion happens in the set, not to the set. periodt.


πŸ”₯ RETURN VALUE πŸ”₯

acl_delete_perm() returns the value 0 if it slayed successfully 😌

otherwise, the value -1 comes back and the global variable errno gets set to indicate the error. so if it's giving -1, go check errno, that's where the tea is πŸ’€


😭 ERRORS 😭

if any of these conditions occur, acl_delete_perm() returns -1 and sets errno to the corresponding value:

  • [EINVAL] β€” two separate ways to earn this one, bestie:
    • the argument permset_d is not a valid descriptor for a permission set within an ACL entry. like it's just... not a real permset. 🚫
    • the argument perm does not contain a valid acl_perm_t value. wrong flavor, wrong vibe. πŸ™ˆ

πŸ“ STANDARDS πŸ“

IEEE Std 1003.1e draft 17 (aka β€œPOSIX.1e” β€” abandoned, RIP boo, you would've loved it here πŸ•ŠοΈ)

and here's the tea for the Linux girlies specifically: in the Linux implementation, perm is a bitwise set of permissions that acl_delete_perm() will all remove at once. so you can nuke several at the same time. BUT β€” and this is the important part β€” this use is not portable. so if you take it anywhere else, it might not hit the same. iykyk ⚠️

πŸ‘€ SEE ALSO πŸ‘€

the whole friend group, go say hi:


🫢 AUTHOR 🫢

derived from the FreeBSD manual pages written by Robert N M Watson <rwatson@FreeBSD.org>, and adapted for Linux by Andreas Gruenbacher <andreas.gruenbacher@gmail.com>.

thank you for your service, legends 🌈


okay that's the whole page, you're officially educated πŸ’œ this was Linux ACL, dated March 23, 2002, and the page is ACL_DELETE_PERM(3). go forth and delete permissions responsibly, bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from