KEYCTL_CHOWN(3)
π 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 grantsetattrpermission 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
- alpine 3.22: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.23: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.24: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- arch rolling: keyutils 1.6.3-4 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 10: keyutils-libs-devel 1.6.3-5.el10 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 9: keyutils-libs-devel 1.6.3-1.el9 Β· GPLv2+ and LGPLv2+
- centos-stream 9: keyutils-libs-devel 1.6.3-1.el9 Β· GPLv2+ and LGPLv2+
- debian bookworm: libkeyutils-dev 1.6.3-2 Β· GPL-2.0-or-later
- debian trixie: libkeyutils-dev 1.6.3-6 Β· GPL-2.0-or-later
- fedora 43: keyutils-libs-devel 1.6.3-6.fc43 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 43: keyutils-libs-devel 1.6.3-6.fc43 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: keyutils-libs-devel 1.6.3-7.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: keyutils-libs-devel 1.6.3-7.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- nixpkgs unstable: keyutils 1.6.3
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- ubuntu noble: libkeyutils-dev 1.6.3-3build1 Β· GPL-2.0-or-later
- ubuntu questing: libkeyutils-dev 1.6.3-6ubuntu2
- ubuntu resolute: libkeyutils-dev 1.6.3-6ubuntu3 Β· GPL-2.0-or-later
- ubuntu stonking: libkeyutils-dev 1.6.3-6ubuntu3 Β· GPL-2.0-or-later
- Copyright (C) 2006 Red Hat, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms