# yum install vsftpd ftp

# vim /etc/vsftpd/vsftpd.conf
----------------------------------------
anonymous_enable=NO #不讓路人登入
local_enable=YES
write_enable=NO #不讓登入者寫入資料
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to FTP service.
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list #將允許登入的帳號寫在此檔案
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
----------------------------------------

# systemctl restart vsftpd

# systemctl enable vsftpd

設定防火牆
# firewall-cmd --permanent --add-port=21/tcp
# firewall-cmd --permanent --add-service=ftp
# firewall-cmd --reload

建立ftp user, 並change shell
# useradd ftpuser01
# passwd ftpuser01
# chsh -s /sbin/nologin ftpuser01

Enable SELinux role
# setsebool -P allow_ftpd_full_access 1
# setsebool -P ftp_home_dir 1

Review config
# egrep -vi '^#|^$' /etc/vsftpd/vsftpd.conf

 

參考資料:
1) http://www.unixmen.com/install-configure-ftp-server-centos-7/
2) http://www.liquidweb.com/kb/how-to-install-and-configure-vsftpd-on-centos-7/
3) http://luyaku.pixnet.net/blog/post/188199646-vsftpd%EF%BC%9Aftp-server-%E5%AE%89%E8%A3%9D%E8%88%87%E8%A8%AD%E5%AE%9A
4) http://prithak.blogspot.tw/2013/07/installation-and-configuration-of.html

dreamtails 發表在 痞客邦 PIXNET 留言(0) 人氣()