LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help me with httpd virtual host set to mount to samba share folder. (https://www.linuxquestions.org/questions/linux-newbie-8/help-me-with-httpd-virtual-host-set-to-mount-to-samba-share-folder-852046/)

InfernalAngel 12-23-2010 10:59 AM

Help me with httpd virtual host set to mount to samba share folder.
 
The scenario like this.

I'm working on Ubuntu 10.10. I've enable samba sharing with full guest access enable.

In my office I had another server (CentOS 5.5) installed just for me and I've created a Apache VirtualHost which root document pointed to share folder on my comp

This is my fstab setting
//my ubuntu computer name/sharing/www /media/www cifs context=system_u:object_r:httpd_sys_content_t:s0,username=username,password=******,iocharset=utf8,fi le_mode=0777,dir_mode=0777 0 0

After label the mount folder as httpd_sys_content_t the Apache web server working in correct way (duno much but at least it can index files and excute some php code so)

then the troll come in : if some file was created by my ubuntu (personal comp) then the file would be listed in Apache virtualhost correctly.

But if I'm ssh to CentOS server goto /media/www which was mounted to my unbuntu computer. Then type command like $mkdir something
Suprising that folder ./something could not be accessed by Apache anymore except I remount by umount and mount it again or "setenforce 0"

What is wrong with my system can anyone point me out of this headache :)

ubyt3m3 12-24-2010 05:45 AM

Most likely the se context of /media/www and /media/www/something is different. Run below commands and compare:

# ls -lZ /media/www
# ls -lZ /media/www/something

If they do differ, run these commands to change its context:

# semanage fcontext -a -t httpd_sys_content_t "/media/www(/.*)?"
# restorecon /media/www/something

Now any directories created below /media/www/ should inherit the same context and you should be ok.

-gibb


All times are GMT -5. The time now is 10:15 PM.