I am trying to setup a situation where I can FTP to my Linux CentOS 7 server and update the web site files from my Windows 7 system. At this point I can FTP to my user's folder using vsftp (/home/robert) and Apache seems to work for the default web site (/var/www/html). I created a virtual host for port 8080 and if I point it to /var/www/8080/public_html it works fine but as soon as I point it to /home/robert/public_html it comes back with 403 Forbidden. You don't have permission to access / on this server. The apache error log shows
[Wed Mar 18 16:12:27.546621 2015] [core:error] [pid 21204] (13)Permission denied: [client 192.168.1.66:57090] AH00035: access to / denied (filesystem path '/home/robert') because search permissions are missing on a component of the path
The apache conf file (/etc/httpd/conf/httpd.conf) has this entry for Virtual Host
Listen 80 Listen 8080 # Virtual Hosts <VirtualHost *:8080> ServerName 192.168.1.10:8080 # DocumentRoot /var/www/8080/public_html DocumentRoot /home/robert/public_html </VirtualHost>
The permissions for /home/robert/public_html/index.html are below
drwxr-xr-x. 7 root root 66 Mar 9 17:16 home dr-x---r-x. 15 robert robert 4096 Mar 16 22:51 robert drwxr-xr-x. 2 robert robert 23 Mar 17 23:28 public_html -rwxr-xr-x. 1 robert robert 332 Mar 17 23:28 index.html
This seems like a permissions issue but I am unclear how to proceed. Do I need to add apache user to my robert individual group? Is selinux doing something here? Any help would be appreciated. Thank you.
UPDATED: ok it appears to me that all web sites are supposed to be located under the /var/www/ folder. It seems selinux wants it that way. So how do I remotely FTP and access (read/write) the web site files??? Let's say I want user robert to FTP to /var/www/testweb and be able to read/write the files there. How is that accomplished???
UPDATED: I looked at the answer posted and ran the three commands below
setsebool -P httpd_enable_homedirs on setsebool -P ftp_home_dir on restorecon -r -v /home
Looks like it did something but the result is the same. I can FTP to user folder still but web site does not show up...403 error.
UPDATED: I also tried to run the following command however it errored out on all files
Command I ran
chcon -Rv --type=httpd_t /home/robert/public_html
Error I received
chcon: failed to change context of ‘index.html’ to ‘unconfined_u:object_r:httpd_t:s0’: Permission denied
I also turned selinux off using setenforce 0 but I still got 403. Advice appreciated...thank you.