Debian Codegraph @

upstream/debian-unstable/man2/KEYCTL_CHOWN.2const

raw
1 .\" Copyright 2016, Michael Kerrisk <[email protected]>
2 .\" Copyright 2016, Eugene Syromyatnikov <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH KEYCTL_CHOWN 2const 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 KEYCTL_CHOWN
10 \-
11 change the ownership of a key
12 .SH LIBRARY
13 Standard C library
14 .RI ( libc ,\~ \-lc )
15 .SH SYNOPSIS
16 .nf
17 .BR "#include <linux/keyctl.h>" " /* Definition of " KEY* " constants */"
18 .BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
19 .B #include <unistd.h>
20 .P
21 .BI "long syscall(SYS_keyctl, KEYCTL_CHOWN, key_serial_t " key ,
22 .BI " uid_t " uid ", gid_t " gid );
23 .fi
24 .SH DESCRIPTION
25 Change the ownership (user and group ID) of a key.
26 .P
27 .I key
28 contains the key ID.
29 .I uid
30 contains the new user ID (or \-1 in case the user ID shouldn't be changed).
31 .I gid
32 contains the new group ID (or \-1 in case the group ID shouldn't be changed).
33 .P
34 The key must grant the caller
35 .I setattr
36 permission.
37 .P
38 For the UID to be changed, or for the GID to be changed to a group
39 the caller is not a member of, the caller must have the
40 .B CAP_SYS_ADMIN
41 capability (see
42 .BR capabilities (7)).
43 .P
44 If the UID is to be changed, the new user must have sufficient
45 quota to accept the key.
46 The quota deduction will be removed from the old user
47 to the new user should the UID be changed.
48 .SH RETURN VALUE
49 On success,
50 0 is returned.
51 .P
52 On error, \-1 is returned, and
53 .I errno
54 is set to indicate the error.
55 .SH VERSIONS
56 A wrapper is provided in the
57 .I libkeyutils
58 library:
59 .BR keyctl_chown (3).
60 .SH STANDARDS
61 Linux.
62 .SH HISTORY
63 Linux 2.6.10.
64 .SH SEE ALSO
65 .BR keyctl (2),
66 .BR keyctl_chown (3)