snipplets.dev/code/C/System/check-root-user.c

19 lines
310 B
C

/**
* https://man.openbsd.org/getuid
*/
#include <unistd.h>
#include <stdio.h>
void main(int argc, char const *argv[]) {
uid_t user = getuid();
uid_t privs = geteuid();
printf("User: %u\n", user);
printf("Privs: %u\n", privs);
puts("::");
char *login = getlogin();
printf("%s\n", login);
}