BLOG ESPERANCA

우분투에서 제대로 chroot 사용하기 본문

카테고리 없음

우분투에서 제대로 chroot 사용하기

yobuce 2016. 6. 14. 11:39

보안에 좋다는 vsftp 를 서버에 설치하고 접속을 하는데, 자꾸.

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Login failed.

라는 에러가 나왔다.

아래의 두 줄이 위 에러의 주범인데, 전부 주석을 넣거나, 주석을 전부 풀고 vsftpd.chroot_list 파일을 만들어 주거나 하면, 접속은 잘 되지만 chroot 기능이 제대로 동작하지 않았다.

#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list
chroot_local_user=YES

참고로 chroot 옵션은 사용자가 지정된 디렉토리 이하로는 접근하지 못하게 설정하는 것이다. 나는 이 옵션을 이용해서 home 디렉토리 이하로는 접근하지 못하게 하고 싶었다. 역시 구글신의 가호를 받아 힌트가 될만한 블로그를 검색해 찾아냈다.

사실 블로그 내용 자체는 위에서 내가 적용해 봤던 방법과 별 다를 바가 없었지만, 마지막에 쥔장이 어디선가 긁어온 문구가 해결에 결정적인 도움이 되었다.

you can choose one of 3 ways:
1. Define option local_root= in configuration file. must by /home or other path to directory with users folders. In this way vsftpd chrooting to /home directory.

2. Define option passwd_chroot_enable=yes in configuration file and change in /etc/passwd file user home directory from «/home/user» to «/home/./user» (w/o quotes).
In this way vsftpd chrooting to /home directory.

3. Download sources of vsftpd-ext, compile and overwrite exist vsftpd binaries or take it from repositories and add to configuration file option allow_writable_root=yes.

[Reference] : 더뿌, 「Issue거리 – vsftpd error 발생 시 (500 oops : vsftpd )」 http://182.209.70.20/?mid=IT&document_srl=564389.

1 번은 공통 chroot 적용할 디렉토리를 설정하라는 거고, 2번은 설정 파일의 passwd 을 이용해서 chroot 디렉토리를 등록해 쓰라는 거고, 3번은 컴파일 다시 하라는 건데, 1번이 딱 내가 원하는 것이었기에, 설정 파일을 열어서…

$> sudo vim /etc/vsftpd.conf

local_root=/home

한줄 추가하고 저장 후…

$> sudo service vsftpd restart

이제 잘 된다. ㅋ