어느부분이 잘못되었는지좀 봐주세요....
글쓴이: songaal / 작성시간: 금, 2009/03/20 - 5:00오후
chroot/jail로 루트를 변경하고 ls를 실행하는 프로그램인데요.
chroot/jail/bin에 ls에 갖다놓았는데 ls가 실행이 안되네요.
root로 실행했구요.. 출력은 항상
exit with -1
로 나옵니다. 어디가 잘못되었는지 좀 알려주세요..
#include <stdio.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char* argv[]){
if (chroot("chroot/jail") == -1) {
perror("error-1: ");
}
if (chdir("/") == -1) {
perror("error-2: ");
}
int ret;
ret = execl("/bin/ls","ls",NULL);
printf("exit with %d\n",ret);
return 0;
}Forums:


코드에는 에러가
코드에는 에러가 없지 싶습니다.
콘솔창에서 한번 chroot를 직접 해보세요 = _=);;;
댓글 달기