라즈베리파이 ftp 설치

라즈베리파이에서 ftp 설치에 관해 검색해보면 거의 모든 포스트가 vsftp 설치에 대한 것이다.
설치 자체는 별것 없다.
vsftpd를 install 하면 된다.

지금 이 글을 쓰는 시점에서 설치되는 버전에서는 설정화일을 손댈 것도 거의 없다.
/etc/vsftpd.conf에서 기본적으로 되어 있는것들을 그대로 써도 된다.

단 chroot 관련해서 문제가 발생할수 있는데 이것을 해결하는 문서를 찾기 힘들다.

일단 ftp용 유저를 따로 만드는 것이 아니고 라즈베리파이에 이미 등록된 유저가 ftp를 사용하게 하는것은
local_enable=YES
로 된다. (현재 설치 되는 버전은 이것이 언코멘트 되어 있다. 그냥 이대로 놔두면 된다)

그리고 이 상태로 아무것도 안건드리고 ftp 접속을 하게 되면 접속이 잘 되긴 하지만, 유저의 홈디렉토리 위로 아무곳이 마구 갈수 있다. 아마도 read write도 될거다(해보진 않았다)
아무래도 찝찝하다

그래서 기본적으로 home 위로 갈수 없게 해 주는 옵션이 있는데
아래 부분을 찾아 본다.

# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list


예전버전에는 저렇게 두 단락으로 나눠져 있지 않았나 보다. 관련 포스트들을 찾아 보면 다 아래 단락만 있다.
chroot_local_user=YES이다.
이걸 활성화 화면 모든 유저가 자신의 home 디렉토리 위로 못간다고 설명은 하고 있다.
그리고 저건 코멘트 상태로 두고 chroot_list_enable=YES를 켜고 chroot_list_file=/etc/vsftpd.chroot_list에 사용자 명을 넣어주면 그 사용자들은 자신의 home 디렉토리 위로 못간다고 설명하고 있다...
그런데!!!!!! 뭘해도 접속하려고 하면 500 에러가 나면서 로긴이 안된다.

이걸 해결하는 문서를 찾기가 쉽지 않다. 여러가지 복잡한 설정이 있는것들도 있고, 이래 저래 말이 많은데,,,, 의외로 간단하게 해결 할수 있다.

allow_writeable_chroot=YES 한줄만 넣어 주면 된다.
위치는 별 상관 없다. 다만 저 설정들 밑에 넣어 주는게 보기에 좋겠다.

# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
allow_writeable_chroot=YES

#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list

물론 설정 바뀌었으니 service vsftpd restart 한번 해주고..

이렇게 해 놓으니 접속 잘되고 쓸데 없이 위로 가지도 않는다.

댓글

이 블로그의 인기 게시물

영화 릴 화질 기준