본문 바로가기

리눅스 서버, FTP 접속 했을 때 상위 경로(다른 계정) 디렉토리가 보이지 않게 하기

728x90
반응형

CentOS는 보통 FTP 프로그램으로 vsftpd를 사용한다. vsftpd의 기본 설정을 변경하지 않으면 FTP로 계정에 접속 했을 때 상위 디렉토리로 이동해 다른 계정의 디렉토리 목록을 볼 수 있다. 접근 권한이 없어 다른 작업은 할 수 없지만 누구의 계정이 있는지 확인 가능하고 root 디렉토리까지 접근 한다면 각종 중요한 디렉토리와 파일들의 위치가 노출 될 수 있다.

다음과 같은 설정을 바꾼다면 사용자는 상위 디렉토리로 접근이 허용되지 않기 때문에 다른 사용자 목록을 확인 할 수 없게 된다.

 

 

# vi /etc/vsftpd/vsftpd.conf

# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=NO
tcp_wrappers=YES

//-- userlist_enable의 값을 바꿔준다. 
//-- 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().
chroot_local_user=YES
chroot_list_enable=NO
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list

//-- chroot_local_user = YES : 사용자 계정 상위로 벗어 날 수 없게 한다.
//-- chroot_list_enable = NO : chroot_list 파일을 사용하지 않는다.
//-- /etc/vsftpd/chroot_list에는 접근 허용 할 사용자 목록을 작성한다.

# service vsftpd restart

728x90
반응형