Debian Codegraph @

upstream/fedora-44/man2const/KEYCTL_CHOWN.2const

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