LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache 403 Forbidden error when accessing cifs mount (https://www.linuxquestions.org/questions/linux-newbie-8/apache-403-forbidden-error-when-accessing-cifs-mount-769005/)

guapo42 11-13-2009 06:23 PM

Apache 403 Forbidden error when accessing cifs mount
 
Before we get started,this is all behind a firewall. I'd never want to set this up on a live server. I'm just setting up a web development box so I can save on my windows desktop and see the site update on my centos5.3 server.


Here's the problem.

When I view normal files (through a browser) in my web root :
/var/www/html/
everything is fine.

When I try to view the same files mounted on my windows share.
mount -t cifs -o uid=48,gid=48,username=domain\\user.name,password=xxxxxxx //domain/web /var/www/html/share

I get a 403 Forbidden error, and the incredibly useful log entry:
[Fri Nov 13 11:34:19 2009] [error] [client 10.0.x.x] (13)Permission denied: access to /share/test.html denied


Here's the permission of the file:
drwxrwxrwx 1 apache apache 4096 Nov 13 2009 .
drwxrwxr-x 12 guapo webdev 4096 Nov 13 11:06 ..
-rwxrwSrwx 1 apache apache 5 Nov 13 2009 test.html

I'm guessing the S is my problem? But for the life of me I don't know how it got there or how to get rid it of.
chmod g-s test.html didn't work, neither did taking out the suid in the options, nor did noperm, not even chmod u-s /bin/mount.

So I'm awfully stuck here and would love some help, because i'm out of things to try.

The other weird thing about all this is that the command above works well and I can access/read/write to the share files just fine. But when I try to use automount I can't mount it in the /var/www directory. The exact same config works in /mnt/ but not in var/www. I don't know if this is related, and I can get around it with ln -s but who knows, it might be useful clue.

Thanks so much in advance,
guapo

janoszen 11-15-2009 06:28 PM

Permissions
 
Checklist:
  • Did you set the allow from all directive on the directory?
  • Did you set the directory index properly?
  • Do you have a directory index file?
  • Does it work if you unmount the share and place the files locally?

Now a word of warning. Using this setup you WILL suffer. Apache locks onto some files and Windows won't let you remove them while opened. This will for example unrecoverably mess up your SVN working copy if you attempt a branch switch. (You are using version control, right?)

If you must use Windows, I recommend using some sort of build and deployment mechanism. Apache Ant for example is a most useful tool.

guapo42 11-16-2009 02:02 PM

Quote:

Originally Posted by janoszen (Post 3758256)
Checklist:
  • Did you set the allow from all directive on the directory?

  • <Directory "/var/www/web">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    The directory I'm trying to access is /var/www/web/guapo/
    which should be accounted for by the above settings.

    Quote:

    Originally Posted by janoszen (Post 3758256)
  • Did you set the directory index properly?

  • DirectoryIndex index.html index.html.var

    Quote:

    Originally Posted by janoszen (Post 3758256)
  • Do you have a directory index file?

  • -rwxrwSrwx 1 apache apache 7 Nov 13 18:33 index.html
    still get 403 Forbidden when I try
    Quote:

    Originally Posted by janoszen (Post 3758256)
  • Does it work if you unmount the share and place the files locally?

Well this is interesting,
if I copy a file from the mount to a directory outside the mount I still can't view it. If I create a new file with the exact same permissions, I can view it fine:
-rw-rw-r-- 1 guapo webdev 14 Nov 16 07:55 index2.html
-rw-rw-r-- 1 guapo webdev 7 Nov 13 18:33 index.html

So this is in /var/www/web/test/ and my mount is now at /var/www/web/guapo/ . I can view index2 created on the machine, I can't view index copied over from the mounted share.

If I unmount the directory and scp over the same file it works like a champ.


Quote:

Originally Posted by janoszen (Post 3758256)
Now a word of warning. Using this setup you WILL suffer. Apache locks onto some files and Windows won't let you remove them while opened. This will for example unrecoverably mess up your SVN working copy if you attempt a branch switch. (You are using version control, right?)

If you must use Windows, I recommend using some sort of build and deployment mechanism. Apache Ant for example is a most useful tool.

Since this is only for personal development I don't mind too much a little pain switching branches. I can turn apache off if/when I need to.

But you bring up a good point this may not be the correct way to go about this. I'm using perforce (not a choice) and I have a working copy syncing to /var/www/web/ . The plan was to have a development copy that I can share with coworkers when I submit my changes each evening, and a working copy that will update everytime I hit ctrl-S. The workflow needs to be scalable so once I set someone up they need to be able to develop without ever sshing into the server.

I'm coming from a mac environment where I could just use vmware to have a working vm of centos running with shared folders. But the new job requires windows and a public hyper-v box for development. Any ideas on how I can hit ctrl-s in the editor and f5 in the browser and see the latest pushed pixel with this setup?

Would ant help me here or, or does it have to be sumbit to perforce server then sync with the dev server each time I want to refresh my changes?

janoszen 11-16-2009 03:06 PM

Can't tell
 
I can't tell about the Samba problem, but that's always a source of problems. If I were you, I'd either use a native environment or use Ant to copy files from your working environment to the Linux system. Ant has the benefit of being extremely configurable and you are able to run it right from Eclipse if you like, just before for example the PHP debugger kicks in.


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