yum -y install vsftpd
touch /var/log/vsftpd.log
chkconfig --level 2345 vsftpd on
service vsftpd start
anonymous_enable=NO # 禁止匿名
local_enable=YES # 允許本地用戶
chroot_list_enable=YES # 限制用戶無法離開家目錄
xferlog_file=/var/log/vsftpd.log
ascii_upload_enable=YES
ascii_download_enable=YES
pam_service_name=vsftpd
guest_enable=YES
guest_username=ftp
user_config_dir=/etc/vsftpd/vuser_conf
建立 /etc/vsftpd/chroot_list 並加入 ftp 用戶。
yum install db4 db4-utils
# 建立用戶密碼文本 /etc/vsftpd/vuser_passwd.txt (奇行用戶名、偶行密碼)
db_load -T -t hash -f /etc/vsftpd/vuser_passwd.txt /etc/vsftpd/vuser_passwd.db
# 編輯 /etc/pam.d/vsftpd 全註釋,加入:
auth required pam_userdb.so db=/etc/vsftpd/vuser_passwd
account required pam_userdb.so db=/etc/vsftpd/vuser_passwd
mkdir /etc/vsftpd/vuser_conf
vi /etc/vsftpd/vuser_conf/ftpuser1
local_root=/opt/var/ftp1
write_enable=YES
anon_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
mkdir /opt/var/ftp/ftpuser1
chmod 777 /opt/var/ftp/ftpuser1
service vsftpd restart
setsebool -P ftpd_disable_trans 1 && service vsftpd restart (SELinux)anon_umask=022 或 000。adduser -d /opt/dongge -g ftp -s /sbin/nologin dongge
passwd dongge
chown -R dongge:ftp /opt/dongge
mount --bind /opt/dongge /var/ftp/dongge
在 httpd.conf 添加 Alias /fileshare "/var/ftp/ftpuser1" 並授權目錄,重啟 httpd 即可用 https://IP/fileshare 下載。