Deleted Added
full compact
setuid.2 (99334) setuid.2 (108028)
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. 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.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)setuid.2 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. 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.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)setuid.2 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/sys/setuid.2 99334 2002-07-03 08:13:25Z chris $
33.\" $FreeBSD: head/lib/libc/sys/setuid.2 108028 2002-12-18 09:22:32Z ru $
34.\"
35.Dd June 4, 1993
36.Dt SETUID 2
37.Os
38.Sh NAME
39.Nm setuid ,
40.Nm seteuid ,
41.Nm setgid ,

--- 10 unchanged lines hidden (view full) ---

52.Fn seteuid "uid_t euid"
53.Ft int
54.Fn setgid "gid_t gid"
55.Ft int
56.Fn setegid "gid_t egid"
57.Sh DESCRIPTION
58The
59.Fn setuid
34.\"
35.Dd June 4, 1993
36.Dt SETUID 2
37.Os
38.Sh NAME
39.Nm setuid ,
40.Nm seteuid ,
41.Nm setgid ,

--- 10 unchanged lines hidden (view full) ---

52.Fn seteuid "uid_t euid"
53.Ft int
54.Fn setgid "gid_t gid"
55.Ft int
56.Fn setegid "gid_t egid"
57.Sh DESCRIPTION
58The
59.Fn setuid
60function
60system call
61sets the real and effective
62user IDs and the saved set-user-ID of the current process
63to the specified value.
64.\" Comment out next block for !_POSIX_SAVED_IDS
65.\" The real user ID and the saved set-user-ID are changed only if the
66.\" effective user ID is that of the super user.
67.\" I.e.
68.\" .Fn setuid
61sets the real and effective
62user IDs and the saved set-user-ID of the current process
63to the specified value.
64.\" Comment out next block for !_POSIX_SAVED_IDS
65.\" The real user ID and the saved set-user-ID are changed only if the
66.\" effective user ID is that of the super user.
67.\" I.e.
68.\" .Fn setuid
69.\" function is equal to
69.\" system call is equal to
70.\" .Fn seteuid
70.\" .Fn seteuid
71.\" function if the effective user ID is not that of the super user.
71.\" system call if the effective user ID is not that of the super user.
72.\" End of block
73The
74.Fn setuid
72.\" End of block
73The
74.Fn setuid
75function is permitted if the specified ID is equal to the real user ID
75system call is permitted if the specified ID is equal to the real user ID
76.\" Comment out next line for !_POSIX_SAVED_IDS
77.\" or the saved set-user-ID
78.\" Next line is for Appendix B.4.2.2 case.
79or the effective user ID
80of the process, or if the effective user ID is that of the super user.
81.Pp
82The
83.Fn setgid
76.\" Comment out next line for !_POSIX_SAVED_IDS
77.\" or the saved set-user-ID
78.\" Next line is for Appendix B.4.2.2 case.
79or the effective user ID
80of the process, or if the effective user ID is that of the super user.
81.Pp
82The
83.Fn setgid
84function
84system call
85sets the real and effective
86group IDs and the saved set-group-ID of the current process
87to the specified value.
88.\" Comment out next block for !_POSIX_SAVED_IDS
89.\" The real group ID and the saved set-group-ID are changed only if the
90.\" effective user ID is that of the super user.
91.\" I.e.
92.\" .Fn setgid
85sets the real and effective
86group IDs and the saved set-group-ID of the current process
87to the specified value.
88.\" Comment out next block for !_POSIX_SAVED_IDS
89.\" The real group ID and the saved set-group-ID are changed only if the
90.\" effective user ID is that of the super user.
91.\" I.e.
92.\" .Fn setgid
93.\" function is equal to
93.\" system call is equal to
94.\" .Fn setegid
94.\" .Fn setegid
95.\" function if the effective user ID is not that of the super user.
95.\" system call if the effective user ID is not that of the super user.
96.\" End of block
97The
98.Fn setgid
96.\" End of block
97The
98.Fn setgid
99function is permitted if the specified ID is equal to the real group ID
99system call is permitted if the specified ID is equal to the real group ID
100.\" Comment out next line for !_POSIX_SAVED_IDS
101.\" or the saved set-group-ID
102.\" Next line is for Appendix B.4.2.2 case.
103or the effective group ID
104of the process, or if the effective user ID is that of the super user.
105.Pp
106The
107.Fn seteuid
100.\" Comment out next line for !_POSIX_SAVED_IDS
101.\" or the saved set-group-ID
102.\" Next line is for Appendix B.4.2.2 case.
103or the effective group ID
104of the process, or if the effective user ID is that of the super user.
105.Pp
106The
107.Fn seteuid
108function
108system call
109.Pq Fn setegid
110sets the effective user ID (group ID) of the
111current process.
112The effective user ID may be set to the value
113of the real user ID or the saved set-user-ID (see
114.Xr intro 2
115and
116.Xr execve 2 ) ;
117in this way, the effective user ID of a set-user-ID executable
118may be toggled by switching to the real user ID, then re-enabled
119by reverting to the set-user-ID value.
120Similarly, the effective group ID may be set to the value
121of the real group ID or the saved set-user-ID.
122.Sh RETURN VALUES
123.Rv -std
124.Sh ERRORS
109.Pq Fn setegid
110sets the effective user ID (group ID) of the
111current process.
112The effective user ID may be set to the value
113of the real user ID or the saved set-user-ID (see
114.Xr intro 2
115and
116.Xr execve 2 ) ;
117in this way, the effective user ID of a set-user-ID executable
118may be toggled by switching to the real user ID, then re-enabled
119by reverting to the set-user-ID value.
120Similarly, the effective group ID may be set to the value
121of the real group ID or the saved set-user-ID.
122.Sh RETURN VALUES
123.Rv -std
124.Sh ERRORS
125The functions will fail if:
125The system calls will fail if:
126.Bl -tag -width Er
127.It Bq Er EPERM
128The user is not the super user and the ID
129specified is not the real, effective ID, or saved ID.
130.El
131.Sh SECURITY CONSIDERATIONS
132Read and write permissions to files are determined upon a call to
133.Xr open 2 .

--- 33 unchanged lines hidden (view full) ---

167.Xr issetugid 2 ,
168.Xr setregid 2 ,
169.Xr setreuid 2
170.Sh STANDARDS
171The
172.Fn setuid
173and
174.Fn setgid
126.Bl -tag -width Er
127.It Bq Er EPERM
128The user is not the super user and the ID
129specified is not the real, effective ID, or saved ID.
130.El
131.Sh SECURITY CONSIDERATIONS
132Read and write permissions to files are determined upon a call to
133.Xr open 2 .

--- 33 unchanged lines hidden (view full) ---

167.Xr issetugid 2 ,
168.Xr setregid 2 ,
169.Xr setreuid 2
170.Sh STANDARDS
171The
172.Fn setuid
173and
174.Fn setgid
175functions are compliant with the
175system calls are compliant with the
176.St -p1003.1-90
177specification with
178.Li _POSIX_SAVED_IDS
179.\" Uncomment next line for !_POSIX_SAVED_IDS
180not
181defined with the permitted extensions from Appendix B.4.2.2.
182The
183.Fn seteuid
184and
185.Fn setegid
176.St -p1003.1-90
177specification with
178.Li _POSIX_SAVED_IDS
179.\" Uncomment next line for !_POSIX_SAVED_IDS
180not
181defined with the permitted extensions from Appendix B.4.2.2.
182The
183.Fn seteuid
184and
185.Fn setegid
186functions are extensions based on the
186system calls are extensions based on the
187.Tn POSIX
188concept of
189.Li _POSIX_SAVED_IDS ,
190and have been proposed for a future revision of the standard.
191.Sh HISTORY
187.Tn POSIX
188concept of
189.Li _POSIX_SAVED_IDS ,
190and have been proposed for a future revision of the standard.
191.Sh HISTORY
192A
192The
193.Fn setuid
193.Fn setuid
194and a
194and
195.Fn setgid
195.Fn setgid
196function calls appeared in
196functions appeared in
197.At v7 .
197.At v7 .