| 1 |
.\" Copyright 1993, Rickard E. Faith <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH getuid 2 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
getuid, geteuid \- get user identity |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ,\~ \-lc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.B #include <unistd.h> |
| 15 |
.P |
| 16 |
.B uid_t getuid(void); |
| 17 |
.B uid_t geteuid(void); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
.BR getuid () |
| 21 |
returns the real user ID of the calling process. |
| 22 |
.P |
| 23 |
.BR geteuid () |
| 24 |
returns the effective user ID of the calling process. |
| 25 |
.SH ERRORS |
| 26 |
These functions are always successful |
| 27 |
and never modify |
| 28 |
.\" https://www.austingroupbugs.net/view.php?id=511 |
| 29 |
.\" 0000511: getuid and friends should not modify errno |
| 30 |
.IR errno . |
| 31 |
.SH STANDARDS |
| 32 |
POSIX.1-2024. |
| 33 |
.SH HISTORY |
| 34 |
4.3BSD, |
| 35 |
POSIX.1-1988. |
| 36 |
.P |
| 37 |
In UNIX\ V6 the |
| 38 |
.BR getuid () |
| 39 |
call returned |
| 40 |
.IR "(euid << 8) + uid" . |
| 41 |
UNIX\ V7 introduced separate calls |
| 42 |
.BR getuid () |
| 43 |
and |
| 44 |
.BR geteuid (). |
| 45 |
.P |
| 46 |
The original Linux |
| 47 |
.BR getuid () |
| 48 |
and |
| 49 |
.BR geteuid () |
| 50 |
system calls supported only 16-bit user IDs. |
| 51 |
Subsequently, Linux 2.4 added |
| 52 |
.BR getuid32 () |
| 53 |
and |
| 54 |
.BR geteuid32 (), |
| 55 |
supporting 32-bit IDs. |
| 56 |
The glibc |
| 57 |
.BR getuid () |
| 58 |
and |
| 59 |
.BR geteuid () |
| 60 |
wrapper functions transparently deal with the variations across kernel versions. |
| 61 |
.P |
| 62 |
On Alpha, instead of a pair of |
| 63 |
.BR getuid () |
| 64 |
and |
| 65 |
.BR geteuid () |
| 66 |
system calls, a single |
| 67 |
.BR getxuid () |
| 68 |
system call is provided, which returns a pair of real and effective UIDs. |
| 69 |
The glibc |
| 70 |
.BR getuid () |
| 71 |
and |
| 72 |
.BR geteuid () |
| 73 |
wrapper functions transparently deal with this. |
| 74 |
See |
| 75 |
.BR syscall (2) |
| 76 |
for details regarding register mapping. |
| 77 |
.SH SEE ALSO |
| 78 |
.BR getresuid (2), |
| 79 |
.BR setreuid (2), |
| 80 |
.BR setuid (2), |
| 81 |
.BR credentials (7) |