SETRUID(3)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… SETRUID(3) β€” Library Functions Manual πŸ’…

okay bestie, this is the glow-up of the SETRUID(3) manual page β€” same facts, way more group-chat energy. Let’s get into it ✨


🌸 NAME 🌸

setruid, setrgid β€” set user and group ID

🧚 LIBRARY 🧚

Standard C Library (libc, -lc) β€” yes, she lives in libc, iconic behavior.

✨ SYNOPSIS ✨

#include <unistd.h>

int
setruid(uid_t ruid);

int
setrgid(gid_t rgid);

πŸ¦‹ DESCRIPTION πŸ¦‹

The setruid() function (and setrgid(), her matching bestie) sets the real user ID (group ID) of the current process. lowkey straightforward, no cap.

πŸŽ€ RETURN VALUES πŸŽ€

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error. so if you see -1, check errno β€” she’s trying to tell you something πŸ’–

⚠️ COMPATIBILITY ⚠️

Heads up, bestie: The use of these calls is not portable. Their use is discouraged; they will be removed in the future. not a drill, fr fr 😭

🚨 ERRORS 🚨

The functions fail if:

  • [EPERM] β€” The user is not the super user and the ID specified is not the real or effective ID.

🌈 SEE ALSO 🌈

getgid(2), getuid(2), setegid(2), seteuid(2), setgid(2), setuid(2) β€” go read the whole squad 🫢

πŸ’œ HISTORY πŸ’œ

The setruid() and setrgid() syscalls appeared in 4.2BSD and were dropped in 4.4BSD. historical icons, honestly πŸ‘‘


Source/version + date moment: this page is from Debian, dated June 2, 1993, and the manual page is SETRUID(3). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms