KEYCTL_CHOWN(2const) | KEYCTL_CHOWN(2const) |
NAME
KEYCTL_CHOWN - change the ownership of a key
LIBRARY
Standard C library (libc, -lc)
SYNOPSIS
#include <linux/keyctl.h> /* Definition of KEY* constants */ #include <sys/syscall.h> /* Definition of SYS_* constants */ #include <unistd.h>
long syscall(SYS_keyctl, KEYCTL_CHOWN, key_serial_t key, uid_t uid, gid_t gid);
DESCRIPTION
Change the ownership (user and group ID) of a key.
key contains the key ID. uid contains the new user ID (or -1 in case the user ID shouldn't be changed). gid contains the new group ID (or -1 in case the group ID shouldn't be changed).
The key must grant the caller setattr permission.
For the UID to be changed, or for the GID to be changed to a group the caller is not a member of, the caller must have the CAP_SYS_ADMIN capability (see capabilities(7)).
If the UID is to be changed, the new user must have sufficient quota to accept the key. The quota deduction will be removed from the old user to the new user should the UID be changed.
RETURN VALUE
On success, 0 is returned.
On error, -1 is returned, and errno is set to indicate the error.
VERSIONS
A wrapper is provided in the libkeyutils library: keyctl_chown(3).
STANDARDS
Linux.
HISTORY
Linux 2.6.10.
SEE ALSO
2024-08-21 | Linux man-pages 6.10 |