httpd, vsftpd and the annoying selinux

Posted by Christian on Server Fault See other posts from Server Fault or by Christian
Published on 2012-10-12T14:30:02Z Indexed on 2012/10/12 15:39 UTC
Read the original article Hit count: 344

Filed under:
|
|
|

I have a CentOS 6.3 installed with httpd running and vsftpd but I am unable to balance permission between the user able to upload over ftp and their website working.

What I do:

I create a user with their home directory as `/home/username` 
I create a sub folder called `html` for their website
I chown their directory `chown -R username:apache /home/username`
I chmod their directory `chmod -R 750 /home/username`
I chcon their directory `chcon -R -t httpd_sys_rw_content_t /home/username` 

and their website loads fine but they are unable to ftp, but if I do the following, they can ftp but their website doesnt load:

chcon -R -t user_home_dir_t /home/username

If I disable selinux, the user can ftp and the website loads. so what is the answer to keep selinux?

© Server Fault or respective owner

Related posts about httpd

Related posts about centos6