KEYCTL_MOVE(3)
β¨ NAME β¨
keyctl_move β bestie, this is the one that moves a key between keyrings π
(it's KEYCTL_MOVE(3), from the Linux Key Management Calls manual, if you were wondering π)
π¦ SYNOPSIS π¦
#include <keyutils.h>
long keyctl_move(key_serial_t key, key_serial_t from_keyring,
key_serial_t to_keyring, unsigned int flags);
πΈ DESCRIPTION πΈ
okay so listen. keyctl_move() takes key and does the whole glow-up atomically β it unlinks it from from_keyring and links it straight into to_keyring in literally one single operation, no in-between era, no awkward transitional phase β¨
Depending on what flags you set, a link to any matching key chillin' in to_keyring might get displaced π (yes, like, evicted. sorry girl.)
flags is a bitwise-OR of zero or more of these:
KEYCTL_MOVE_EXCLβ if there's already a matching key in to_keyring, don't displace it, just throw an error instead π« (not me choosing violence, the function chooses it for you)
The caller must have write permission on both keyrings to be able to create or remove links in them π
And the caller must have link permission on a key to be able to create a new link to it, periodt.
π RETURN VALUE π
On success, keyctl_move() returns 0 β slay π
On error, the value -1 gets returned and errno will have been set to an appropriate error π
π ERRORS π
ENOKEYβ the key, or one of the keyrings you specified, is invalid.ENOKEYβ a key with the same type and description is present in to_keyring andKEYCTL_MOVE_EXCLis set. (yes bestie,ENOKEYshows up twice, that's just how it is π)EKEYEXPIREDβ the key, or one of the keyrings you specified, has expired. RIP πͺ¦EKEYREVOKEDβ the key, or one of the keyrings you specified, has been revoked.EACCESβ the key exists, but it's not linkable by the calling process.EACCESβ the keyrings exist, but they're not writable by the calling process.ENOMEMβ not enough memory to effect the changes π΅EDQUOTβ expanding to_keyring would exceed the keyring owner's quota.
π LINKING π
This is a library function, and it lives in libkeyutils π«Ά
When you're linking, you gotta pass -lkeyutils to the linker. no cap.
π SEE ALSO π
keyctl(1), add_key(2), keyctl(2), request_key(2), keyctl(3), keyrings(7), keyutils(7)
mwah π that's the whole page β Linux, dated 29 May 2019, and the manpage is KEYCTL_MOVE(3). go move some keys, you absolute icon πβ¨
π¦ 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) 2019 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