Skip to content

Instantly share code, notes, and snippets.

@cooliscool
Created November 21, 2018 14:30
Show Gist options
  • Save cooliscool/66f0306105f533825405dc807d81da33 to your computer and use it in GitHub Desktop.
Save cooliscool/66f0306105f533825405dc807d81da33 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main(void)
{
printf("My UID is: %d. My GID is: %d My EUID is: %d. My EGID is: %d \n", getuid(), getgid() , geteuid(), getegid());
system("/usr/bin/id");
setuid(geteuid());
printf("My UID is: %d. My GID is: %d My EUID is: %d. My EGID is: %d \n", getuid(), getgid() , geteuid(), getegid());
system("/usr/bin/id");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment