vsftpd出现“Response: 500 OOPS: cannot change directory”解决方法

 

笔者用的Linux发行版本为centos6.4,当用FTP客户端连接时,出现如下错误提示:

 

Response: 500 OOPS: cannot change directory:/home/liangwode

Error: Critical error

Error: Could not connect to server

 

原因分析:

 

在终端下输入如下命令:

 

[root@liangwode log]# 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 是处于off的状态,也就是说当前是不允许用户通过FTP登录到/home/*(*代表对应的用户)的目录下的,为此,我们可以用以下方法解决:

 

[root@liangwode log]# setsebool ftp_home_dir on

 输入以上命令就是开启ftp_home_dir的功能,再次查看一下状态:

 

[root@liangwode log]# 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                                on

ftpd_connect_db                             off

ftpd_use_passive_mode                       off

httpd_enable_ftp_server                     off

tftp_anon_write                             off

 发现已经开启了,然后FTP客户端就可以正常登录了.