ACL_DELETE_DEF_FILE(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_DEF_FILE(3) πŸ’…

okay so bestie, welcome to the Linux Access Control Lists library page for acl_delete_def_file and acl_delete_def_file_at β€” this is section 3 of the Library Functions Manual, and we're about to delete a default ACL by filename. yes, by filename. slay. πŸŽ€


✨ NAME ✨

acl_delete_def_file, acl_delete_def_file_at β€” delete a default ACL by filename


πŸ“š LIBRARY πŸ“š

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


🫢 SYNOPSIS 🫢

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

int
acl_delete_def_file(const char *path_p);

int
acl_delete_def_file_at(int dirfd, const char *path_p, int at_flags);

🌸 DESCRIPTION 🌸

so the acl_delete_def_file() function deletes a default ACL from the directory whose pathname you hand it in path_p. and listen β€” if path_p is a symbolic link, acl_delete_def_file() operates on the directory the link refers to. it dereferences, it doesn't get shy about it. πŸ¦‹

now the permission vibe check: the effective user ID of the process must match the owner of the file or directory, OR the process must have the CAP_FOWNER capability, for the request to succeed. no cap. that's the rule. πŸ‘‘

if path_p is not a directory, the function just fails. periodt. but here's the cute part: it is no error if the directory pointed to by path_p doesn't even have a default ACL. so deleting something that isn't there? totally fine, we move on, we don't stress. πŸ’–

🧚 acl_delete_def_file_at() 🧚

acl_delete_def_file_at() operates in exactly the same way as acl_delete_def_file(), except for the differences described right here:

  • If the pathname given in path_p is relative, then it's interpreted relative to the directory referred to by the file descriptor dirfd β€” rather than relative to the current working directory of the calling process, which is what acl_delete_def_file() does. different starting point, same energy. 🌈
  • If path_p is relative and dirfd is the special value AT_FDCWD, then path_p is interpreted relative to the current working directory of the calling process (like acl_delete_def_file() does). okay so sometimes it's the same, we love consistency. ✨
  • If path_p is absolute, then dirfd is ignored. sorry dirfd, not your moment. πŸ’€

The at_flags argument can either be 0, or include one or more of the following flags ORed together:

  • AT_EMPTY_PATH β€” If path_p is an empty string, operate on the file referred to by dirfd (which may have been obtained using the open(2) O_PATH flag). In this case, dirfd can refer to any type of file, not just a directory. so flexible, so iconic. πŸŽ€
  • AT_SYMLINK_NOFOLLOW β€” If path_p refers to a symbolic link, do not dereference it: instead, fail the operation and set the global variable errno to ENOTSUP. This indicates that the symbolic link cannot have ACLs. ngl it's giving "sorry babe, symlinks can't hold ACLs". πŸ™ˆ

⭐ RETURN VALUE ⭐

The acl_delete_def_file() and acl_delete_def_file_at() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. 0 = slay, -1 = check errno, bestie. πŸ’œ


πŸ’€ ERRORS πŸ’€

If any of the following conditions occur, the acl_delete_def_file() and acl_delete_def_file_at() functions return the value -1 and set errno to the corresponding value:

  • [EBADF] β€” The argument path_p is relative but the argument dirfd is neither AT_FDCWD nor a valid file descriptor.
  • [EINVAL] β€” The file referred to by path_p is not a directory.
    • An invalid flag was specified in the at_flags argument.
  • [ENOTDIR] β€” A component of the path prefix is not a directory.
    • The argument path_p is relative and the argument dirfd is a file descriptor referring to a file other than a directory.
  • [ENOTSUP] β€” The argument at_flags includes the flag AT_SYMLINK_NOFOLLOW and path_p is a symbolic link.
    • The file system on which the file identified by path_p is located does not support ACLs, or ACLs are disabled.
  • [EPERM] β€” The process does not have appropriate privilege to perform the operation to delete the default ACL.
  • [EROFS] β€” This function requires modification of a file system which is currently read-only.

πŸ“œ STANDARDS πŸ“œ

IEEE Std 1003.1e draft 17 (β€œPOSIX.1e”, abandoned)

Function acl_delete_def_file_at() is a Linux specific extension.


πŸ‘€ SEE ALSO πŸ‘€

acl_get_file(3), acl_set_file(3), acl(5)


πŸ’– 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 legends, we owe you everything 🫢


and that's the whole page, bestie!! 🌸 this came from the Linux ACL manual, dated June 5, 2026, and it lives at ACL_DELETE_DEF_FILE(3). go forth and delete those default ACLs responsibly, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from