ACL_EXTENDED_FILE(3)
π ACL_EXTENDED_FILE(3) π
okay bestie, so this is a page from the Library Functions Manual, and it's all about three little functions that go "hey, does this file have ~extra~ ACL info or not?" π¦
β¨ NAME β¨
acl_extended_file, acl_extended_file_at, acl_extended_file_nofollow β test for information in ACLs by file name π
π LIBRARY π
The Linux Access Control Lists library (that's libacl, and you link it with -lacl). π
πΈ SYNOPSIS πΈ
#include <sys/types.h>
#include <acl/libacl.h>
int
acl_extended_file(const char *path_p);
int
acl_extended_file_at(int dirfd, const char *path_p, int at_flags);
int
acl_extended_file_nofollow(const char *path_p);
π« DESCRIPTION π«
okay so here's the tea. acl_extended_file() returns 1 if the file or directory whose pathname you handed it in path_p is associated with an extended access ACL, or if the directory that path_p points at is associated with a default ACL. π
It returns 0 if the file has neither an extended access ACL nor a default ACL. nothing. zero. dry. π
And if path_p is a symbolic link? then acl_extended_file() gives you info about the file or directory the link refers to β like, it follows it, no cap. π§
So what even is an extended ACL? it's an ACL that contains entries other than the three required entries of tag types ACL_USER_OBJ, ACL_GROUP_OBJ and ACL_OTHER. that's it, that's the definition. π«Ά
and here's why that matters: if the result ofacl_extended_file()for a file object is0, then ACLs define no discretionary access rights other than those already defined by the traditional file permission bits. so like, the classic rwx bits are telling the whole story, periodt. β
also, quick heads up β access to the file object may be further restricted by other mechanisms, such as Mandatory Access Control schemes. the access(2) system call can be used to check whether a given type of access to a file object would be granted. (yes, this function is not the whole vibe check, it's just one of them. π)
π¦ acl_extended_file_at() π¦
acl_extended_file_at() operates in exactly the same way as acl_extended_file(), except for the differences described here. (dramatic pause π)
- If the pathname given in
path_pis relative, then it is interpreted relative to the directory referred to by the file descriptordirfdβ rather than relative to the current working directory of the calling process, as is done byacl_extended_file(). main character behavior: your own base directory. π - If
path_pis relative anddirfdis the special valueAT_FDCWD, thenpath_pis interpreted relative to the current working directory of the calling process (likeacl_extended_file()). so basically back to normal. β¨ - If
path_pis absolute, thendirfdis ignored. literally ignored. not even looking at it. π
The at_flags argument can either be 0, or include one or more of the following flags ORed:
AT_EMPTY_PATHβ Ifpath_pis an empty string, operate on the file referred to bydirfd(which may have been obtained using theopen(2)O_PATHflag). In this case,dirfdcan refer to any type of file, not just a directory. πAT_SYMLINK_NOFOLLOWβ Ifpath_prefers to a symbolic link, do not dereference it: instead, fail the operation and set the global variableerrnotoENOTSUP. This indicates that the symbolic link cannot have ACLs. π₯ (no follow, no problem, just an error code bestie)
π acl_extended_nofollow() π
The acl_extended_file_at() function operates in exactly the same way as acl_extended_file() with a dirfd value of AT_FDCWD and an at_flags value of AT_SYMLINK_NOFOLLOW. π«Ά
π RETURN VALUE π
If successful, these functions return:
1β if the file object referred to bypath_phas an extended access ACL or a default ACL π₯³0β if the file object referred to bypath_phas neither an extended access ACL nor a default ACL π«₯
Otherwise, the value -1 is returned and the global variable errno is set to indicate the error. π
π ERRORS π
If any of the following conditions occur, these functions return -1 and set errno to the corresponding value:
[EACCES]β Search permission is denied for a component of the path prefix.[EBADF]β The argumentpath_pis relative but the argumentdirfdis neitherAT_FDCWDnor a valid file descriptor.[EINVAL]β An invalid flag was specified in theat_flagsargument.[ENAMETOOLONG]β The length of the argumentpath_pis too long.[ENOENT]β The named object does not exist or the argumentpath_ppoints to an empty string.[ENOTDIR]β A component of the path prefix is not a directory.- The argument
path_pis relative and the argumentdirfdis a file descriptor referring to a file other than a directory.
- The argument
[ENOTSUP]β The argumentat_flagsincludes the flagAT_SYMLINK_NOFOLLOWandpath_pis a symbolic link.- The file system on which the file identified by
path_pis located does not support ACLs, or ACLs are disabled.
- The file system on which the file identified by
ngl that last one is the "your filesystem said no β€οΈ" error. know it, love it, respect it. π
π STANDARDS π
This is a non-portable, Linux specific extension to the ACL manipulation functions defined in IEEE Std 1003.1e draft 17 (βPOSIX.1eβ, abandoned). yeah. abandoned. it's giving ghosted. π»
π SEE ALSO π
access(2), acl_get_file(3), acl(5)
βοΈ AUTHOR βοΈ
Written by Andreas Gruenbacher <andreas.gruenbacher@gmail.com>. iconic of him honestly. π
and that's the whole page bestie!! π this came to you from the Linux ACL crew, dated June 5, 2026 β mwah, go check your ACLs, slay, bye!! π¦β¨π
π¦ where this page comes from
- 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+
- 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.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 stonking: libacl1-dev 2.4.0-1
- (C) 2002-2026 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