CAPNG_APPLY_CAPS_FD(3)

πŸ’– CAPNG_APPLY_CAPS_FD(3) πŸ’–

okay bestie, welcome to the Libcap-ng API corner of the man pages, where we make files hold their own capabilities like the little main characters they are ✨


🌸 NAME 🌸

capng_apply_caps_fd β€” write file-based capabilities to extended attributes πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <cap-ng.h>

int capng_apply_caps_fd(int fd);

✨ DESCRIPTION ✨

so here's the tea, bestie πŸ“ β€” this function writes the file based capabilities to the extended attributes of the file that the descriptor was opened against. like, the fd you hand it? that's the file getting the glow-up πŸ’…

real talk: the bounding set is NOT included in file based capabilities operations. it just doesn't come to this party πŸ™…β€β™€οΈ

also, lowkey important: this function will only work if it was compiled on a kernel that supports file based capabilities, such as 2.6.26 and later. if your kernel is giving ancient energy, this isn't happening πŸ’€


πŸ”₯ RETURN VALUE πŸ”₯

  • 0 β€” slay, it worked, success πŸ’–
  • -1 β€” something besides a regular file got passed in, or the extended attribute operation failed 😭
  • -2 β€” the file capability data cannot be serialized πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘


🫢 AUTHOR 🫢

Steve Grubb


and that's the whole vibe, bestie β€” this page came from the Libcap-ng API, brought to you by Red Hat, dated Sept 2020, and it's literally called CAPNG_APPLY_CAPS_FD(3). periodt. πŸ’œπŸŒˆ