[root@localhost ~]# yum install vsftpd -yshell
[root@localhost ~]# useradd -d /opt/ftp/ftp_user_atu -m ftp_user_atu #分配ftp上傳目錄安全
[root@localhost ~]# usermod -s /sbin/nologin ftp_user_atu #分配shell爲不可登錄/sbin/nologinbash
[root@localhost ~]# passwd ftp_user_atu #設置密碼app
#匿名登錄
anonymous_enable=NOtcp
#本地用戶
local_enable=YESspa
#寫操做
write_enable=YES
local_umask=022
anon_umask=022
dirmessage_enable=YES.net
#日誌記錄
xferlog_enable=YESrest
#主動端口
connect_from_port_20=YES日誌
#日誌格式化
xferlog_std_format=YEScode
#歡迎信息
ftpd_banner=Welcome to FTP service.
#只能看到當前用戶路徑
chroot_local_user=YES
chroot_list_enable=NO
ls_recurse_enable=YES
listen=YES
pam_service_name=vsftpd#只有user_list的用戶能夠登錄
userlist_enable=YES
userlist_deny=NO
tcp_wrappers=YES
reverse_lookup_enable=NO
#ftp時間
use_localtime=YES
ftp_user_atu
[root@localhost ~]# service vsftpd restart
500 OOPS: cannot change directory:/opt/disk/33/ftp/ftp_user_ipms
chmod -R 755 /opt/disk/33
查看SELinux的ftpd狀態
[root@localhost ~]# sestatus -b| grep ftp
allow_ftpd_anon_write off
allow_ftpd_full_access off
allow_ftpd_use_cifs off
allow_ftpd_use_nfs off
ftp_home_dir off
ftpd_connect_db off
ftpd_use_passive_mode off
httpd_enable_ftp_server off
tftp_anon_write off
將ftp_home_dir設置爲on後重啓ftp服務恢復正常
[root@localhost ~]# setsebool ftp_home_dir 1
[root@localhost ~]# service vsftpd restart
rm -rf /etc/vsftpd/.vsftpd.conf.swp vi /etc/vsftpd/vsftpd.conf 添加 userlist_file=/etc/vsftpd/user_list allow_writeable_chroot=YES 註釋 tcp_wrappers cp -rf /etc/vsftpd /etc/vsftpd.bak rpm -e vsftpd rm -rf /etc/vsftpd mv /etc/vsftpd.bak /etc/vsftpd cd /opt/disk/backup/soft/vsftpd-3.0.3 make install /usr/local/sbin/vsftpd /etc/vsftpd/vsftpd.conf & vi /etc/rc.local /usr/local/sbin/vsftpd /etc/vsftpd/vsftpd.conf & ln -s /lib64/libcap.so.2.16 /lib64/libcap.so LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/lib64 cd /opt/disk/backup/soft/vsftpd-3.0.3 make clean make make install cp RedHat/vsftpd.pam /etc/pam.d/vsftpd /usr/local/sbin/vsftpd /etc/vsftpd/vsftpd.conf & cat /etc/vsftpd/vsftpd.conf|grep -v ^#|grep -v ^$|grep -v '^;'