1GETUID(2) Linux Programmer's Manual GETUID(2)
2
3
4
6 getuid, geteuid - get user identity
7
9 #include <unistd.h>
10
11 uid_t getuid(void);
12 uid_t geteuid(void);
13
15 getuid() returns the real user ID of the calling process.
16
17 geteuid() returns the effective user ID of the calling process.
18
20 These functions are always successful and never modify errno.
21
23 POSIX.1-2001, POSIX.1-2008, 4.3BSD.
24
26 History
27 In UNIX V6 the getuid() call returned (euid << 8) + uid. UNIX V7 in‐
28 troduced separate calls getuid() and geteuid().
29
30 The original Linux getuid() and geteuid() system calls supported only
31 16-bit user IDs. Subsequently, Linux 2.4 added getuid32() and ge‐
32 teuid32(), supporting 32-bit IDs. The glibc getuid() and geteuid()
33 wrapper functions transparently deal with the variations across kernel
34 versions.
35
36 On Alpha, instead of a pair of getuid() and geteuid() system calls, a
37 single getxuid() system call is provided, which returns a pair of real
38 and effective UIDs. The glibc getuid() and geteuid() wrapper functions
39 transparently deal with this. See syscall(2) for details regarding
40 register mapping.
41
43 getresuid(2), setreuid(2), setuid(2), credentials(7)
44
46 This page is part of release 5.13 of the Linux man-pages project. A
47 description of the project, information about reporting bugs, and the
48 latest version of this page, can be found at
49 https://www.kernel.org/doc/man-pages/.
50
51
52
53Linux 2021-03-22 GETUID(2)