結果測試的時候發現
ftp localhost
ftp> cd cdrom
550 Failed to change directory.
沒法切換目錄到/pub/cdrom linux
緣由是SElinux的FTP傳輸審覈功能禁止切換目錄 shell
解決辦法: 測試
1. /etc/sysconfig/selinux上禁用之,重啓Linux生效 spa
2. 不重啓linux,臨時停用selinux的辦法, rest
/usr/sbin/setenforce 0
/usr/sbin/setsebool -P ftpd_disable_trans 1 service vsftpd restart
其中參數 -P表示永久性生效 code
使用getsebool -a | grep ftp命令找到ftp的bool值
匿名上傳setsebool -P allow_ftpd_anon_write on
禁用ftp傳輸審覈setsebool -P ftpd_disable_trans on server
sestatus [root@xen ~]# sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: permissive Mode from config file: enforcing Policy version: 21 Policy from config file: targeted [root@xen ~]# getsebool -a | grep ftp allow_ftpd_anon_write --> off allow_ftpd_full_access --> off allow_ftpd_use_cifs --> off allow_ftpd_use_nfs --> off allow_tftp_anon_write --> off ftp_home_dir --> off ftpd_disable_trans --> off ftpd_is_daemon --> on httpd_enable_ftp_server --> off tftpd_disable_trans --> off [root@xen ~]# setsebool -P ftpd_disable_trans on [root@xen ~]# service vsftpd restart
------------------------------------------------ ci
若是問題依舊,再嘗試以下的方法: get
打開 /etc/vsftpd/vsftp.conf,將 it
# users to NOT chroot(). chroot_list_enable=YES改爲
# users to NOT chroot(). chroot_list_enable=NO並把ftp用戶添加到/etc/vsftpd/chroot_list中