ACL_SET_FD(3)
π ACL_SET_FD(3) π
okay bestie, so this one lives in section 3 of the manual β that's the library functions section, for when you're writing actual C code and not just yelling at your shell. Welcome to the Linux Access Control Lists corner of the internet. Let's get into it. π¦
πΈ LIBRARY πΈ
Linux Access Control Lists library β link it with libacl, -lacl. That's the vibe. π
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <sys/acl.h>
int
acl_set_fd(int fd, acl_t acl);
two includes, one function, zero drama. iconic honestly. π
π«Ά DESCRIPTION π«Ά
So like, what does acl_set_fd() actually do? It associates an access ACL with the file referred to by fd. That's the whole plot. You hand it a file descriptor, you hand it an ACL, and boom β they're together now. π
But wait, there's a gatekeeper. π€ For the request to succeed, the effective user ID of the process must match the owner of the file, OR the process must have the CAP_FOWNER capability. That's it, that's the entry fee. No matching owner and no cap? No ACL for you, babes.
π RETURN VALUE π
- On success:
acl_set_fd()returns the value0. π slay. - On failure: the value
-1is returned, and the global variableerrnogets set to tell you exactly what went wrong. π read yourerrno, bestie, it's literally trying to communicate with you.
π₯ ERRORS π₯
If any of these conditions occur, acl_set_fd() returns the value -1 and sets errno to the corresponding value. Here's the whole roster, no skips:
[EBADF]β thefdargument is not a valid file descriptor. not a real fd, not a real problem we can solve. π[EINVAL]β the argumentacldoes not point to a valid ACL. OR: the ACL has more entries than the file referred to byfdcan obtain. too much ACL for this file to hold, sorry. π[ENOSPC]β the directory or file system that would contain the new ACL cannot be extended, or the file system is out of file allocation resources. no room, no resources, no ACL. π[ENOTSUP]β the file identified byfdcannot be associated with the ACL because the file system on which the file is located does not support this. the filesystem literally said "not my thing." π[EPERM]β the process does not have appropriate privilege to perform the operation to set the ACL. permissions said no. π«[EROFS]β this function requires modification of a file system which is currently read-only. you cannot write to a read-only filesystem, that's the whole point of read-only. π₯²
fr fr, if you're getting-1back, checkerrnobefore you do literally anything else. it's giving helpful, let it help you. π«Ά
π STANDARDS π
IEEE Std 1003.1e draft 17 β aka βPOSIX.1eβ, aka the abandoned one. π it's canon but it's also kinda orphaned. we still love it though. periodt.
π SEE ALSO π
Go read these too, bestie, they're all in the group chat:
π 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>. absolute legends, we thank them for their service. π«‘β¨
aaaand that's the whole page, babe. this one's from Linux ACL, dated March 23, 2002 β old but still holding it down. go set some ACLs, you've got this. ππ¦π
π¦ where this page comes from
- alpine 3.22: acl-doc 2.3.2-r1 Β· LGPL-2.1-or-later AND GPL-2.0-or-later
- alpine 3.23: acl-doc 2.3.2-r1 Β· LGPL-2.1-or-later AND GPL-2.0-or-later
- alpine 3.24: acl-doc 2.3.2-r1 Β· LGPL-2.1-or-later AND GPL-2.0-or-later
- arch rolling: acl 2.4.0-1 Β· LGPL-2.1-or-later AND GPL-2.0-or-later
- centos-stream 10: libacl-devel 2.4.0-2.el10 Β· LGPL-2.1-or-later
- centos-stream 9: libacl-devel 2.4.0-2.el9 Β· LGPLv2+
- centos-stream 9: libacl-devel 2.4.0-2.el9 Β· LGPLv2+
- debian bookworm: libacl1-dev 2.3.1-3
- debian trixie: libacl1-dev 2.3.2-2+b1
- fedora 43: libacl-devel 2.3.2-4.fc43 Β· LGPL-2.1-or-later
- fedora 43: libacl-devel 2.3.2-4.fc43 Β· LGPL-2.1-or-later
- fedora 43: libacl-devel 2.4.0-1.fc43 Β· LGPL-2.1-or-later
- fedora 43: libacl-devel 2.4.0-1.fc43 Β· LGPL-2.1-or-later
- fedora 44: libacl-devel 2.3.2-6.fc44 Β· LGPL-2.1-or-later
- fedora 44: libacl-devel 2.3.2-6.fc44 Β· LGPL-2.1-or-later
- fedora 44: libacl-devel 2.4.0-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: libacl-devel 2.4.0-1.fc44 Β· LGPL-2.1-or-later
- nixpkgs unstable: acl 2.4.0
- opensuse-leap 16.0: libacl-devel 2.4.0-160000.1.1 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: libacl-devel 2.4.0-160000.1.1 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: libacl-devel 2.4.0-160000.1.1 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: libacl-devel 2.4.0-160000.1.1 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- ubuntu jammy: libacl1-dev 2.3.1-1
- ubuntu noble: libacl1-dev 2.3.2-1build1
- ubuntu noble: libacl1-dev 2.3.2-1build1.1
- ubuntu resolute: libacl1-dev 2.3.2-2
- ubuntu stonking: libacl1-dev 2.4.0-1
- (C) 2002 Andreas Gruenbacher, <andreas.gruenbacher@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms