inode_owner_or_capable(9)
π inode_owner_or_capable(9) β like, the Kernel API Manual page, bestie
okay so first things first: this is a page from the Kernel API Manual, section 9, and it's about inode_owner_or_capable. yes that's a mouthful, no we're not renaming it. let's go π«Ά
β¨ NAME β¨
inode_owner_or_capable β checks the current task's permissions on an inode, that's literally the whole vibe check π
πΈ SYNOPSIS πΈ
bool inode_owner_or_capable (struct mnt_idmap *idmap , const struct
inode *inode );
it returns a bool, it takes two args, it's giving "small function, big responsibilities" energy. π
π¦ ARGUMENTS π¦
idmapβ the idmap of the mount the inode was found from. yeah. that thing. πΊοΈinodeβ the inode being checked. the main character of this whole operation, honestly. π
π DESCRIPTION π
so this returns true if the current task either has CAP_FOWNER in a namespace with the inode owner uid mapped, or straight-up owns the file. two ways to slay, pick whichever one applies to you. β¨
now here's the part where you gotta pay attention β if the inode was found through an idmapped mount, you must pass the idmap of the vfsmount through idmap. and then this function will take care of mapping the inode according to idmap before it checks permissions. it handles all that for you, which is honestly so nice of it. π§
on non-idmapped mounts β or if you want the permission check to happen on the raw inode β just pass nop_mnt_idmap. simple as that, no cap. π
π₯ SEE ALSO π₯
the kernel file ./fs/inode.c and, like, the entire inode friend group β this section is long, grab a snack:
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_dio_wait(9)timestamp_truncate(9)inode_set_ctime_current(9)inode_set_ctime_deleg(9)in_group_or_capable(9)mode_strip_sgid(9)dump_inode(9)
okay that's the whole page, you ate that honestly ππ
source/version: ./fs π¦ date: October 2026 β mwah, see you in the group chat, bye bestie!! πβπ
π¦ 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