sysfs_link_change_owner(9)
π sysfs_link_change_owner π
Hey bestie, welcome to the sysfs_link_change_owner(9) page β yes, that's the kernel API manual, and yes, we're about to make symlink ownership make sense. Sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
sysfs_link_change_owner β change owner of a sysfs file. That's the whole vibe. π«Ά
πΈ SYNOPSIS πΈ
int sysfs_link_change_owner (struct kobject *kobj , struct kobject *targ
, const char *name , kuid_t kuid , kgid_t kgid );
Like, five whole arguments. Not me being obsessed with a function signature π but here we are.
π ARGUMENTS π
kobjβ the object of thekernfs_nodethe symlink is located in. Think of it as: where the link physically lives, bestie πtargβ the object of thekernfs_nodethe symlink points to. This is the destination the link is doing its little pointy thing at πnameβ name of the link. Literally just the name. Iconic, no notes.kuidβ new owner'skuid. The fresh uid, slay πkgidβ new owner'skgid. The fresh gid to match, periodt π
π¦ DESCRIPTION π¦
Okay so, what does this bad boy actually do? It looks up the sysfs symlink entry name under kobj, and changes the ownership to kuid/kgid. The way it does the lookup is in the namespace of targ β important detail, don't sleep on it π
Returns 0 on success or an error code on failure. That's it, that's the whole story. Clean, simple, main character energy β¨
Heads up bestie: failure means you get an error code back, not 0. Always check the return value, fr fr π₯
π SEE ALSO π
Kernel file ./fs/sysfs/file.c, plus the whole friend group:
sysfs_create_file_ns(9)sysfs_add_file_to_group(9)sysfs_chmod_file(9)sysfs_break_active_protection(9)sysfs_unbreak_active_protection(9)sysfs_remove_file_ns(9)sysfs_remove_file_self(9)sysfs_remove_file_from_group(9)sysfs_create_bin_file(9)sysfs_remove_bin_file(9)sysfs_file_change_owner(9)sysfs_change_owner(9)sysfs_emit(9)sysfs_emit_at(9)sysfs_bin_attr_simple_read(9)
Every single one of them, no cap. Go read them too, iykyk π
That's the page, bestie! π§ This little gem lives at ./fs/sysfs, and it's dated October 2026 in the Kernel API Manual. Mwah, go change some owners 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