Last active
August 29, 2015 14:04
-
-
Save kgadek/923bf91332f51f50e878 to your computer and use it in GitHub Desktop.
Chroot implemented. See: http://stackoverflow.com/a/16503389/547223
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
int main(int c, char **v, char **e) { | |
int rc; const char *m; | |
if ( (m="chdir" ,rc= chdir(v[1]) ) == 0 | |
&& (m="chroot",rc=chroot(v[1]) ) == 0 | |
&& (m="setuid",rc=setuid(getuid())) == 0 ) | |
m="execve", execve(v[2],v+3,e); | |
perror(m); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment