.\" Copyright (c) 1983, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" %sccs.include.redist.man% .\" .\" @(#)setuid.2 6.6 (Berkeley) 02/03/93 .\" .Dd .Dt SETUID 2 .Os BSD 4.2 .Sh NAME .Nm setuid , .Nm seteuid , .Nm setgid , .Nm setegid , .Nd set user and group ID .Sh SYNOPSIS .Fd #include .Fd #include .Ft int .Fn setuid "uid_t uid" .Ft int .Fn seteuid "uid_t euid" .Ft int .Fn setgid "gid_t gid" .Ft int .Fn setegid "gid_t egid" .Sh DESCRIPTION The .Fn setuid function .Pq Fn setgid sets both the real and effective user ID (group ID) of the current process as specified. .Pp The .Fn seteuid function .Pq Fn setegid sets the effective user ID (group ID) of the current process. .Pp .Sh RETURN VALUES Upon success, these functions return 0; otherwise \-1 is returned. .Pp If the user is not the super user, or the uid specified is not the real, effective ID, or saved ID, these functions return \-1. .Sh SEE ALSO .Xr getuid 2 , .Xr getgid 2 .Sh HISTORY A .Fn setuid and .Fn setgid syscall appeared in .At v6 .