#include < sys/types.h > #include < unistd.h > #include < stdio.h > static void printuid() { printf("uid = %d euid = %d\n", (int)getuid(), (int)geteuid()); } int main() { uid_t uid, euid; uid = getuid(); euid = geteuid(); printuid(); if (seteuid(uid) < 0){ perror("seteuid"); return 1; } printuid(); if (seteuid(euid)<0){ perror("seteuid"); return 1; } printuid(); return 0; }