SETEUID(3POSIX)

✨ SETEUID πŸ’… the POSIX era ✨

okay bestie, so this one is a page from the POSIX Programmer's Manual β€” that's the manual name, that's the vibe, that's the whole thing. but real talk, a heads up before we even start:

πŸ™ˆ The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

like, no cap, check your own system before you go feral. πŸ’€


🌸 NAME 🌸

seteuid β€” set effective user ID

the way this function just... changes who you are, effective-wise. main character energy fr fr. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <unistd.h>

int seteuid(uid_t uid);

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea. πŸ“

If uid is equal to the real user ID or the saved set-user-ID, or if the process has appropriate privileges, then seteuid() shall set the effective user ID of the calling process to uid.

and the plot twist? the real user ID and the saved set-user-ID shall remain unchanged. like, they're not coming with you on this journey. they stay home. πŸ’…

Also, and this is important, bestie β€” the seteuid() function shall not affect the supplementary group list in any way. not even a little. not even a vibe. it just doesn't touch it. periodt. βœ‹


⭐ RETURN VALUE ⭐

  • Upon successful completion, 0 shall be returned. slay, we ate. πŸŽ€
  • Otherwise, -1 shall be returned and errno set to indicate the error. 😭

πŸ”₯ ERRORS πŸ”₯

The seteuid() function shall fail if:

  • EINVAL β€” The value of the uid argument is invalid and is not supported by the implementation. like girl that's not a real uid, what are you doing. πŸ™ˆ
  • EPERM β€” The process does not have appropriate privileges and uid does not match the real user ID or the saved set-user-ID. so basically you don't have permission AND you're not even one of the accepted uids. the audacity. πŸ’€
The following sections are informative.

(yes, that's literally a thing the page says. informative-only, no rules, just vibes. ✨)


πŸ¦‹ EXAMPLES πŸ¦‹

None. 😭 literally none. the page said "we're not giving you examples, bestie, go figure it out." iconic behaviour honestly.


🌈 APPLICATION USAGE 🌈

None. again. nothing. the void. 🫢


🧚 RATIONALE 🧚

Refer to the RATIONALE section in setuid(). that's it. that's the whole rationale. it's giving "go ask your other parent." πŸ’…


πŸ’œ FUTURE DIRECTIONS πŸ’œ

None. πŸŽ€


πŸ‘‘ SEE ALSO πŸ‘‘

  • exec
  • getegid()
  • geteuid()
  • getgid()
  • getuid()
  • setegid()
  • setgid()
  • setregid()
  • setreuid()
  • setuid()

The Base Definitions volume of POSIX.1‐2017: <sys_types.h>, <unistd.h>


Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page, bestie!! πŸ’–βœ¨

this lil masterpiece dropped as part of the IEEE/The Open Group situation back in 2017, under the name SETEUID(3POSIX) β€” so yeah, shoutout to the Open Group for the lore, and shoutout to you for actually reading a man page in 2025. we love a scholarly queen. πŸŽ€πŸ‘‘πŸ’