1 .\" Copyright (c) 1983, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)setuid.2 8.1 (Berkeley) 6/4/93
29 .\" $FreeBSD: src/lib/libc/sys/setuid.2,v 1.13.2.7 2003/02/14 00:49:42 keramida Exp $
39 .Nd set user and group ID
46 .Fn setuid "uid_t uid"
48 .Fn seteuid "uid_t euid"
50 .Fn setgid "gid_t gid"
52 .Fn setegid "gid_t egid"
57 sets the real and effective
58 user IDs and the saved set-user-ID of the current process
59 to the specified value.
60 .\" Comment out next block for !_POSIX_SAVED_IDS
61 .\" The real user ID and the saved set-user-ID are changed only if the
62 .\" effective user ID is that of the super user.
65 .\" function is equal to
67 .\" function if the effective user ID is not that of the super user.
71 function is permitted if the specified ID is equal to the real user ID
72 .\" Comment out next line for !_POSIX_SAVED_IDS
73 .\" or the saved set-user-ID
74 .\" Next line is for Appendix B.4.2.2 case.
75 or the effective user ID
76 of the process, or if the effective user ID is that of the super user.
81 sets the real and effective
82 group IDs and the saved set-group-ID of the current process
83 to the specified value.
84 .\" Comment out next block for !_POSIX_SAVED_IDS
85 .\" The real group ID and the saved set-group-ID are changed only if the
86 .\" effective user ID is that of the super user.
89 .\" function is equal to
91 .\" function if the effective user ID is not that of the super user.
95 function is permitted if the specified ID is equal to the real group ID
96 .\" Comment out next line for !_POSIX_SAVED_IDS
97 .\" or the saved set-group-ID
98 .\" Next line is for Appendix B.4.2.2 case.
99 or the effective group ID
100 of the process, or if the effective user ID is that of the super user.
106 sets the effective user ID (group ID) of the
108 The effective user ID may be set to the value
109 of the real user ID or the saved set-user-ID (see
113 in this way, the effective user ID of a set-user-ID executable
114 may be toggled by switching to the real user ID, then re-enabled
115 by reverting to the set-user-ID value.
116 Similarly, the effective group ID may be set to the value
117 of the real group ID or the saved set-group-ID.
121 The functions will fail if:
124 The user is not the super user and the ID
125 specified is not the real, effective ID, or saved ID.
138 functions are compliant with the
142 .\" Uncomment next line for !_POSIX_SAVED_IDS
144 defined with the permitted extensions from Appendix B.4.2.2.
149 functions are extensions based on the
152 .Dv _POSIX_SAVED_IDS ,
153 and have been proposed for a future revision of the standard.
159 function calls appeared in