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

19 lines
310 B
C
Raw Normal View History

2024-05-16 20:40:00 +03:00
/**
* 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);
}