CentOS9 FTP 서버 설치

CentOS9에 FTP 서버 설치하기 위해서 아래의 커맨드를 실행합니다.

yum install vsftpd

패키지가 이미 설치되어 있는지를 확인하고 싶다면 아래 커맨드를 사용하세요.

yum search vsftpd

아래의 커맨드로 설치한 vsftpd의 서비스를 띄워줍니다.

systemctl start vsftpd.service
systemctl enable vsftpd.service

아래의 vsftpd.conf 파일을 수정해줍니다.
/etc/vsftpd/vsftpd.conf

…
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
…
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES
ascii_download_enable=YES
…
# 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
…
# with the listen_ipv6 directive.
listen=NO
…
# Make sure, that one of the listen options is commented !!
listen_ipv6=YES

수정한 vsftpd.conf에 아래의 옵션을 새롭게 추가해줍니다.

pam_service_name=vsftpd
local_root=public_html
use_localtime=YES
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list
allow_writeable_chroot=YES

아래의 chroot_list 파일에 접속할 유저명을 추가합니다.
/etc/vsftpd/chroot_list

아래의 ftpusers 파일에 접속할 유저명을 지우거나 주석 처리합니다.
/etc/vsftpd/ftpusers

아래의 config 파일에서 SELINUX 옵션을 수정합니다.
/etc/selinux/config

SELINUX=permissive

설정이 끝나도 방화벽 때문에 접속이 제한되므로 허가 서비스를 추가합니다.

firewall-cmd --permanent --zone=public --add-service=ftp
firewall-cmd --reload

–permanent를 설정하면 서비스를 재기동하더라도 변경사항이 보존됩니다. 설정하지 않으면 재기동시 수정 전의 설정으로 되돌아갑니다.

제목과 URL을 복사했습니다