Steps to install vsftpd and jail users to their home directories:
Note-1) On typing ‘ftp localhost’, if you get “Install command ‘ftp’ to provide command ‘ftp’? [N/y]” error message, don’t worry that perfectly normal. Simply type y. This is “ftp client binary”, whereas vsftpd is “ftp server”.
Step-1) To install vsftpd, on the terminal type:
su -c ‘yum -y install ftp vsftpd’
Step-2) To edit vsftpd configuration file, on the terminal type:
su -c ‘[nano/vi/emacs] /etc/vsftpd/vsftpd.conf’
Step-3) To jail users to their respective home directories, search the file for text “chroot_local_user” and remove the ‘#’ pound sign at the begining of the line and change it’s value to ‘YES’. Save and exit.
Step-4) Restart vsftpd service:
su -c ‘/etc/init.d/vsftpd restart’
Step-5) If you skip this, you will get “500 OOPS: cannot change directory:/home/user_name” error when you login to ftp server.
su -c ‘setsebool -P ftp_home_dir on’
Congratulations! you have successfully jailed users to their respective home directories.
Step-6) To test, on the terminal windows type:
(when prompted, enter local computer login credentials)
ls -lh ../../.. OR whatever you want to check.
I sincerely hope you liked it. Please leave your valuable comments and suggestions.