sys_capset(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… sys_capset β€” the kernel api manual, but make it make sense

okay so real talk, today we're learning sys_capset(9) from the Kernel API Manual and honestly? it's lowkey a glow-up moment for your process's permissions. bestie, let's get into it πŸŽ€


✨ NAME ✨

sys_capset β€” set capabilities for a process or (*) a group of processes

like, it's literally the function that hands out (or takes away) capability vibes. and yes, that asterisk on "group of processes" is doing a little 😭 because...


πŸ¦‹ SYNOPSIS πŸ¦‹

long sys_capset (cap_user_header_t header , const cap_user_data_t data
);

look at that signature. long return, two args, iconic. no cap.


🌸 ARGUMENTS 🌸

  • header β€” pointer to struct that contains capability version and target pid data. it's giving "who am I doing this for and which version of the rules are we playing by" energy.
  • data β€” pointer to struct that contains the effective, permitted, and inheritable capabilities. the actual content, the main character of the two structs ngl.

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's the tea: it sets capabilities for the current process only. that's it. that's the whole vibe.

and the ability to do it for any other process(es)? deprecated and removed. gone. no thoughts, empty head, deleted. the (*) in the name is basically a little historical ghost πŸ‘». so if you showed up hoping to buff some other process's capabilities, sorry bestie, that door is nailed shut.

the restrictions on setting capabilities are specified as: (and yes, these are word-for-word the rules, I'm not summarising, I would never)

  • I: any raised capabilities must be a subset of the old permitted
  • P: any raised capabilities must be a subset of the old permitted
  • E: must be set to a subset of new permitted
πŸ’€ lowkey read those carefully β€” it's all about subsets. you can't just mint new powers out of thin air. you can only pass along what was already permitted, and the new effective set has to stay inside the new permitted set. the vibe check is strict.

Returns 0 on success and < 0 on error. (yes, literally < 0, not a specific errno, that's just how it's written here, don't come for me 🫢)


πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, they're all in their flop era of being underappreciated:

that's the whole squad, all 13 of them + the kernel file. read them, love them, cite them in your commit messages πŸ’œ


and that's the page!! mwah πŸ’‹ this lil kernel api manual dropped from ./kernel in October 2026 β€” go forth and set those capabilities responsibly, bestie πŸŒˆβ­πŸ“

πŸ“¦ where this page comes from