본문 바로가기

Linux Server

CentOS7 FTP Setup

FTP 데몬 설치

yum install vsftpd -y


FTP 설정

vi /etc/vsftpd/vsftpd.conf 

anonymous_enable=NO

local_enable=YES

write_enable=YES

local_umask=022

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

xferlog_file=/var/log/xferlog

xferlog_std_format=YES

chroot_local_user=YES

listen=YES

#listen_ipv6=YES

pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES

allow_writeable_chroot=YES


FTP 시작

systemctl enable vsftpd

systemctl start vsftpd

systemctl status vsftpd


Job for vsftpd.service failed because the control process exited with error code. See "systemctl status vsftpd.service" and "journalctl -xe" for details.

FTP 시작 실패 시, vsftpd.conf 파일 내 ipv6 설정이 NO, 혹은 주석처리 되어있는 지 확인한다.


방화벽 확인

firewall-cmd --permanent --add-port=21/tcp

firewall-cmd --permanent --add-service=ftp

firewall-cmd --reload


SELINUX 확인

/usr/sbin/getsebool -a | grep ftp

setsebool -P tftp_home_dir on

setsebool -P allow_ftpd_full_access on


FTP접속, 오류 해결

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

FTP접속을 시도했을 때 아래와 같은 에러를 뿜는 경우, 아래와 같이 설정을 추가해준다.

vi /etc/vsftpd/vsftpd.conf

allow_writeable_chroot=YES


425 Failed to establish connection.

위와 같은 오류가 생기면, FTP클라이언트의 연결 방법이 Active로 되어있는 지 확인한다.

Passive로 연결하고자 할 경우에 대해서는 차후 기술한다.