xref: /freebsd/lib/libsys/setresuid.2 (revision 3f0efe05432b1633991114ca4ca330102a561959)
1.\" Copyright (c) 2000
2.\"      Sheldon Hearn.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES
19.\"
20.Dd February 7, 2015
21.Dt SETRESUID 2
22.Os
23.Sh NAME
24.Nm getresgid ,
25.Nm getresuid ,
26.Nm setresgid ,
27.Nm setresuid
28.Nd "get or set real, effective and saved user or group ID"
29.Sh LIBRARY
30.Lb libc
31.Sh SYNOPSIS
32.In sys/types.h
33.In unistd.h
34.Ft int
35.Fn getresgid "gid_t *rgid" "gid_t *egid" "gid_t *sgid"
36.Ft int
37.Fn getresuid "uid_t *ruid" "uid_t *euid" "uid_t *suid"
38.Ft int
39.Fn setresgid "gid_t rgid" "gid_t egid" "gid_t sgid"
40.Ft int
41.Fn setresuid "uid_t ruid" "uid_t euid" "uid_t suid"
42.Sh DESCRIPTION
43The
44.Fn setresuid
45system call sets the real,
46effective and saved user IDs of the current process.
47The analogous
48.Fn setresgid
49sets the real, effective and saved group IDs.
50.Pp
51Privileged processes may set these IDs
52to arbitrary values.
53Unprivileged processes are restricted
54in that each of the new IDs must match one of the current IDs.
55.Pp
56Passing -1 as an argument causes the corresponding value
57to remain unchanged.
58.Pp
59The
60.Fn getresgid
61and
62.Fn getresuid
63calls retrieve the real, effective, and saved group and user IDs of
64the current process, respectively.
65.Sh RETURN VALUES
66.Rv -std
67.Sh ERRORS
68.Bl -tag -width Er
69.It Bq Er EPERM
70The calling process was not privileged
71and tried to change one or more IDs to a value
72which was not the current real ID, the current effective ID
73nor the current saved ID.
74.It Bq Er EFAULT
75An address passed to
76.Fn getresgid
77or
78.Fn getresuid
79was invalid.
80.El
81.Sh SEE ALSO
82.Xr getegid 2 ,
83.Xr geteuid 2 ,
84.Xr getgid 2 ,
85.Xr getuid 2 ,
86.Xr issetugid 2 ,
87.Xr setgid 2 ,
88.Xr setregid 2 ,
89.Xr setreuid 2 ,
90.Xr setuid 2
91.Sh HISTORY
92These functions first appeared in HP-UX.
93