系统环境:Red Hat Enterprise Linux Server 6
在iptables的规则中已经对FTP服务放行了
windows客户端访问时的情况:
C:\Users\Administrator>ftp 192.168.18.140
Connected to 192.168.18.140.
220 (vsFTPd 2.2.2)
User (192.168.18.140:(none)): huage
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/huage
500 OOPS: priv_sock_get_cmd
Connection closed by remote host.
出现这种情况是因为selinux的缘故:
[root@desktop huage]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted
[root@desktop huage]# getsebool -a |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
httpd_enable_ftp_server --> off
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> off
[root@desktop huage]# setsebool ftp_home_dir on //重启后失效
[root@desktop huage]# setsebool -P ftp_home_dir on //永久保存