In some cases you may get an error as 500 OOPS: cannot change directory:/home/$user when you try to connect to FTP, the error is coming up why because ‘selinux‘ is enabled in the server.
If you are getting the error as 500 OOPS: cannot change directory:/home/user error on server setup with vsftp.
@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/$user Login failed. ftp> bye
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.
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 httpsd_enable_ftp_server –> off tftpd_disable_trans –> off
Enable the ftp_home_dir using :
[Server1]# setseboll -P ftp_home_dir on