Friday, July 12, 2013

500 OOPS: cannot change directory:/home/username

ftp error : 500 OOPS: cannot change directory:/home/username

Solution I : 
Disable SELinux. To see, how to disable it, Click here.

Solution II :
If you do not want to disable SELinux. Follow this.
Check directory status.
$ getsebool -a | grep ftp
If ftp_home_dir is set to off, the error can be there, we need to make this attribute on using
$ setsebool -P ftp_home_dir on
Now restart vsftpd and try to reconnect again.
or
$ setsebool -P ftp_home_dir=1
Now restart vsftpd and try to reconnect again.

If you are still facing error, check the username directory inside /home directory.
The username directory should be there to log in to the ftp account.

vsftpd : 550 create directory operation failed

ftp error : 550 create directory operation failed 

Solution I : 
Disable SELinux. To see, how to disable it, Click here.

Solution  II :
If you do not want to disable SELinux. Follow this.
Run following commands.
# chcon -Rv --type user_home_dir_t /path/of/ftp/directory
OR
# chcon -t public_content_rw_t /path/of/ftp/directory # setsebool -P allow_ftpd_anon_write=1
Now restart vsftpd and try to reconnect again.

Solution  III :
If you are getting this error on ubuntu then the SELinux solution might not work for you because it is not installed by default on ubuntu.

Open vsftpd.conf and uncomment following line.

# write_enable=YES
Restart vsftpd.

Now try to connect but if you get following error

# 500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Add this attribute in vsftpd.conf
# allow_writeable_chroot=YES
Restart vsftpd.

Now you should be able to create and remove directory/files using filezilla.

/usr/bin/env: php: No such file or directory

/usr/bin/env: php: No such file or directory

If you are getting this error, it means php is not installed or the file is corrupted.
Install it using
$ sudo apt-get install php5-cli
If you are still getting the error, Install all php packages using
$ sudo apt-get install php5 $ sudo apt-get install libapache2-mod-php5