.\" Copyright (c) 1983, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" %sccs.include.redist.man% .\" .\" @(#)setuid.2 6.5 (Berkeley) 06/04/92 .\" .Dd .Dt SETUID 3 .Os BSD 4.2 .Sh NAME .Nm setuid , .Nm seteuid , .Nm setruid , .Nm setgid , .Nm setegid , .Nm setrgid .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 setruid "uid_t ruid" .Ft int .Fn setgid "gid_t gid" .Ft int .Fn setegid "gid_t egid" .Ft int .Fn setrgid "gid_t rgid" .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 The .Fn setruid function .Pq Fn setrgid sets the real user ID (group ID) of the current process. .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 or effective ID, these functions return \-1. .Sh SEE ALSO .Xr setreuid 2 , .Xr setregid 2 , .Xr getuid 2 , .Xr getgid 2 .Sh HISTORY A .Fn setuid and .Fn setgid syscall appeared in .At v6 .