KEYCTL_CHOWN(3)

πŸ“¦
version 1.6.3 Β· 2 versions
  • 1.6.3 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.6.1 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– KEYCTL_CHOWN β€” the keyctl_chown(3) glow-up πŸ’–

okay bestie so this is a page from the Linux Key Management Calls manual, and it's literally about changing who owns a key. yes. keys have owners now. we love accountability. πŸŽ€


✨ NAME ✨

keyctl_chown β€” change the ownership of a key πŸ‘‘


🌸 SYNOPSIS 🌸

#include <keyutils.h>

long keyctl_chown(key_serial_t key, uid_t uid, gid_t gid);

she takes three args and she's not sorry about it πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

keyctl_chown() changes the user and group ownership details of a key. that's it. that's the whole vibe. transferring the deed, signing over the title, the whole ceremony. 🏠✨

A setting of -1 on either uid or gid will cause that setting to be ignored. so if you don't wanna touch one of them, just hit it with a -1 and move on, no cap. πŸ™ˆ

now here's the part where the rules show up. a process that does not have the SysAdmin capability may not:

  • change a key's UID, or
  • set the key's GID to a value that doesn't match the process's own GID or one of its group list.

like, you can't just hand the keys to the kingdom to a random stranger. that's giving chaos. 😭

also the caller must have setattr permission on a key to be able to change its ownership. no setattr, no ownership change, periodt. πŸ”


⭐ RETURN VALUE ⭐

On success keyctl_chown() returns 0. πŸŽ‰

On error, the value -1 will be returned and errno will have been set to an appropriate error. classic. she tells you what went wrong, you just have to look. πŸ‘€


πŸ’€ ERRORS πŸ’€

  • ENOKEY β€” The specified key does not exist. it's not there. gone. ghosted. πŸ‘»
  • EKEYEXPIRED β€” The specified key has expired. bestie she's past her prime, she's expired like milk. πŸ₯›
  • EKEYREVOKED β€” The specified key has been revoked. someone took her privileges away and honestly? it was probably deserved. 🚫
  • EDQUOT β€” Changing the UID to the one specified would run that UID out of quota. oop, they're at their limit, no more for them. πŸ“‰
  • EACCES β€” The key exists, but does not grant setattr permission to the calling process. she's there, she's real, she's just not letting you in. πŸ’…

🌈 LINKING 🌈

This is a library function that can be found in libkeyutils. when you're linking, -lkeyutils should be specified to the linker. don't forget it or the linker will simply not know her. 🫢


🧚 SEE ALSO 🧚

keyctl(1), add_key(2), keyctl(2), request_key(2), keyctl(3), keyrings(7), keyutils(7)


and that's the whole page, bestie!! go forth and reassign ownership responsibly, mwah πŸ’–

this came from the Linux keyutils manual pages, dated 4 May 2006, and the page itself is KEYCTL_CHOWN(3) β€” icon behavior from 2006, honestly. slay. 🌟

πŸ“¦ where this page comes from