View Single Post
  #5  
Old 6th May 2012, 03:08 PM
Fenrin Offline
Registered User
 
Join Date: Apr 2010
Location: Earth
Posts: 858
Re: Fedora 16 permissions /var/www folder

you could do the following:
  • add you user to the group apache in the file /etc/group (you can do it via editing this file or use the graphical tool "User and groups")
  • set the group owner of /var/www/html like this "chgrp apache -R /var/www/html
  • give this group write permission with "chmod g+rw -R /var/www/html" (execute permission would be x, if you need that too)
  • for some application, you will have to change SELinux settings

to see some interesting SELinux options you can use this commands:
Code:
getsebool -a | grep user
getsebool -a | grep http
you can enable such a option like this:
Code:
setsebool -P httpd_can_network_connect on
maybe intersting options: httpd_read_user_content, httpd_can_network_connect, httpd_can_network_connect_db, allow_user_mysql_connect or allow_user_postgresql_connect

instead of /var/www/html you can also use ~/public_html (~ is a abbreviated form of your user home directory).
to do this:
• setsebool -P httpd_enable_homedirs 1
• edit the file /etc/httpd/conf/httpd.conf: UserDir enabled, uncomment UserDir public_html

to allow applications (for example a php forum) write access to certain directories, for example in case of fluxbb:
• chcon -R -h -t httpd_sys_content_t /home/user/public_html
• chcon -R -h -t httpd_sys_script_rw_t /home/user/public_html/fluxbb/cache
• chcon -R -h -t httpd_sys_script_rw_t /home/user/public_html/fluxbb/img/avatars

Last edited by Fenrin; 1st July 2012 at 12:57 PM.
Reply With Quote