1SETRUID(3) Library Functions Manual SETRUID(3)
2
3
4
6 setruid, setrgid - set user and group ID
7
9 #include <sys/types.h>
10 int
11 setruid(ruid)
12 uid_t ruid
13
14 int
15 setrgid(rgid)
16 gid_t rgid
17
19 The setruid function (setrgid) sets the real user ID (group ID) of the
20 current process.
21
23 Upon success, these functions return 0; otherwise -1 is returned.
24
25 If the user is not the super user, or the uid specified is not the real
26 or effective ID, these functions return -1.
27
28 The use of these calls is not portable. Their use is discouraged; they
29 will be removed in the future.
30
32 setuid(2), setgid(2), seteuid(2), setegid(2), getuid(2), getgid(2)
33
35 The setruid and setrgid syscalls appeared in 4.2BSD and were dropped in
36 4.4BSD.
37
38
39
404th Berkeley Distribution December 3, 1997 SETRUID(3)