Search My Techie Guy

Tuesday, July 15, 2014

500 OOPS: cannot change directory:/home/user_name - Problem Solved

OS = Red Hat Enterprise Linux 6.2

Problem:

Created a new user and gave him access to ftp but couldn't login with the error below:

# ftp localhost
Trying ::1...
ftp: connect to address ::1Connection refused
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220 (vsFTPd 2.2.2)
Name (localhost:root): drivetests
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/drivetests
Login failed.
ftp> bye
#

check the current status of your selinux policy:

# getenforce
Enforcing
#

Check the selinux ftp policy status:

# 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
tftp_anon_write --> off


switch on this parameter: ftp_home_dir --> on

# setsebool -P ftp_home_dir on


check again to make sure that it has been switched on:

# 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 --> on
ftpd_connect_db --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off


Restart the FTP server:

# /etc/init.d/vsftpd restart

Test logging in to ftp again:

# ftp localhost
Trying ::1...
ftp: connect to address ::1Connection refused
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220 (vsFTPd 2.2.2)
Name (localhost:root):
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 
ftp> bye
221 Goodbye.

No comments: