SOLVED : 500 OOPS: cannot change directory:/home/user VSftp | Centos

Question :

 

I am getting 500 OOPS: cannot change directory:/home/user error on server setup with vsftp, what is the problem and how can i resolve this?

 

@server1:~# ftp xxx.xxx.xxx.xxx
Connected to xxx.xxx.xxx.xxx.
220 (vsFTPd 2.2.2)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (xxx.xxx.xxx.xxx:root): ray
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/ray
Login failed.
ftp> bye

 

Answer :

 

 

This could be due to selinux enabled in the server which usually blocks programs that chrooting /home directory by its default security policy. To solve this problem, you need to disable the selinux if not need in your server or you need to set the selinux enable policy for ftp program to allow access.

 

Disabling selinux completely :

 

Login as root and edit the /etc/selinux/config

  • # vi /etc/selinux/config

Change the SELINUX=enforcing to SELINUX=disabled and reboot your server.

 

Enabling Selinux policy for ftp access :

Login your server as root and check the current status of your selinux policy using:

 

  • # getenforce
    Enforcing

Check the ftp policy status using

 

  • [Server1]# getsebool -a | grep ftp

 

Which usually returns the following output :

 

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 –> on (change that to on in ur case this option is off)
ftpd_disable_trans –> off
ftpd_is_daemon –> on
httpd_enable_ftp_server –> off
tftpd_disable_trans –> off

 

Enable the ftp_home_dir using :

 

  • [Server1]# setseboll -P ftp_home_dir on

 

Try access your ftp login’s again and you should be able to login successfully now!