in_group_or_capable(9)
π in_group_or_capable(9) β like, the Kernel API Manual edition π
okay bestie, sit down, because today we're learning about in_group_or_capable β yes it's a mouthful, yes it slays, and yes it's literally just asking "are you allowed to keep that setgid bit or not" π¦
β¨ NAME β¨
in_group_or_capable β check whether the caller is CAP_FSETID privileged π«
πΈ SYNOPSIS πΈ
bool in_group_or_capable (struct mnt_idmap *idmap , const struct inode
*inode , vfsgid_t vfsgid );
π ARGUMENTS π
idmapβ the idmap of the mount the inode was found from. the receipts, basically π§Ύinodeβ the inode we're checking. the main character fr πvfsgidβ the new/currentvfsgidof the inode. the gid in question π
β DESCRIPTION β
so here's the vibe check: check whether vfsgid is in the caller's group list or whether the caller is privileged with CAP_FSETID over inode. that's it, that's the whole function π«Ά
why do we care? because this is how you figure out whether the setgid bit can be kept or must be dropped β like, highkey important decision energy π₯
π RETURN π
trueβ if the caller is sufficiently privileged πfalseβ if not π
no in-between, no "it depends", just a clean boolean slay β¨
π¦ SEE ALSO π¦
the whole inode friend group, and honestly they're all icons:
inode_init_always_gfp(9),alloc_inode(9),drop_nlink(9),clear_nlink(9),set_nlink(9),inc_nlink(9)inode_sb_list_add(9),__insert_inode_hash(9),__remove_inode_hash(9),evict_inodes(9),new_inode(9),unlock_new_inode(9)lock_two_nondirectories(9),unlock_two_nondirectories(9),inode_insert5(9),iget5_locked(9),iget5_locked_rcu(9),iget_locked(9)iunique(9),ihold(9),ilookup5_nowait(9),ilookup5(9),ilookup(9),find_inode_nowait(9)find_inode_rcu(9),find_inode_by_ino_rcu(9),iput(9),iput_not_last(9),bmap(9),inode_update_time(9)generic_update_time(9),atime_needs_update(9),file_remove_privs(9),current_time(9),file_update_time(9),file_modified_flags(9)file_modified(9),kiocb_modified(9),inode_init_owner(9),inode_owner_or_capable(9),inode_dio_wait(9),timestamp_truncate(9)inode_set_ctime_current(9),inode_set_ctime_deleg(9),mode_strip_sgid(9),dump_inode(9)
and the source of truth itself: the kernel file ./fs/inode.c π
ngl bestie, if you got this far you're officially a filesystem girlie now π π§
okay that's the whole page!! this little gem lives in ./fs in the kernel tree, it's the October 2026 version, and it's filed under in_group_or_capable(9) in the Kernel API Manual. mwah, go check your setgid bits responsibly πππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms