linux下搭建的vsftpd服务器,ls无法查看目录,无法上传下载文件了!
错误消息:
ftp> ls
227 Entering Passive Mode (192,168,2,222,110,161)
150 Here comes the directory listing.
226 Directory send OK.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
226 Directory send OK.
查看ftp的命令:
通过 passive 开启和关闭 PASV模式,再ls 也是同样的问题,参看man ftpd_selinux,找到了解决方法。
解决办法:
还有一个办法就是禁用selinux,也管用。
vi /etc/sysconfig/selinux
SELINUX=enforcing --> SELINUX=disabled
修改后,需要重启机器才能生效。
附,常见的setsebool 命令
BOOLEANS
SELinux policy is based on least privilege required and may also be customizable by setting a boolean with setsebool.
Allow ftp servers to read and write files with the public_content_rw_t file type.
setsebool -P allow_ftpd_anon_write on
Allow ftp servers to read or write files in the user home directories.
setsebool -P ftp_home_dir on
Allow ftp servers to read or write all files on the system.
setsebool -P allow_ftpd_full_access on
Allow ftp servers to use cifs for public file transfer services.
setsebool -P allow_ftpd_use_cifs on
Allow ftp servers to use nfs for public file transfer services.
setsebool -P allow_ftpd_use_nfs on
system-config-selinux is a GUI tool available to customize SELinux policy settings.