GETUID(2)
π GETUID(2) β get user identification π
okay bestie, so we're in the System Calls Manual section of your Unix man pages, and today's episode is all about finding out who you are. not like, spiritually. like, as a process. πͺͺβ¨
πΈ NAME πΈ
getuid, geteuid β get user identification
π LIBRARY π
Standard C Library (libc, -lc)
β¨ SYNOPSIS β¨
#include <unistd.h>
uid_t
getuid(void);
uid_t
geteuid(void);
π«Ά DESCRIPTION π«Ά
so. getuid() is the system call that hands you back the real user ID of the process that's calling it. and geteuid() does the same thing but for the effective user ID of the calling process. two little IDs, two little functions, one very cute family. π
now the lore: the real user ID is the ID of the user who actually invoked the program. that's the human. the person. the main character. π
meanwhile the effective user ID is the one that gives the process extra permissions while it's running β specifically during βset-user-IDβ mode processes. so because effective UID can be all elevated and fancy, you use getuid() when you actually want to determine the real-user-id of the calling process. it's giving "don't get it twisted, I want the real one." π
π ERRORS π
okay so here's the good news: getuid() and geteuid() are always successful. like, always. no cap. and there's no return value reserved to indicate an error β so don't go looking for one, bestie, it's not there. π«
fr fr, these two cannot fail. they simply ate and left no crumbs. π₯
π SEE ALSO π
π STANDARDS π
the geteuid() and getuid() system calls are expected to conform to ISO/IEC 9945-1:1990 (βPOSIX.1β). so yeah, they're certified. iconic behavior. π
π¦ HISTORY π¦
getuid()first appeared in Version 1 AT&T UNIX. a true OG. πgeteuid()showed up later, in Version 4 AT&T UNIX. little sibling energy. π
π bye bestie π
that's the whole page, and it came to you from Debian, dated December 1, 2017. go check your IDs, stay hydrated, and remember: the real user ID is who you are, the effective user ID is who you get to be. πβ¨π«Ά
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1980, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms