views:

70

answers:

3

Hello, I am having trouble getting apache to serve a file through the XSendFile when it is in a directory mounted with samba.

To give a little background: I have a Ruby on Rails app that is slowly replacing an ASP.NET application, and I have it running on a linux server running apache2 and passenger. The Windows machine that is running the ASP.NET code is sharing an upload directory that I have mounted via Samba.

Whenever I try to send a file using the X_SENDFILE header I get this in my apache server logs:

Partial results are valid but processing is incomplete: xsendfile: unable to stat file: /path/to/file

but when I manually type in: stat /path/to/file it will give me file statistics. I know the file is there. (I have also tried this after logging in as the user apache runs under) The file permissions as far as I can tell are correct.

Is there some kind of issue with apache's XSendFile and files over an SMB share?

A: 

maybe files/permissions issue (as user x, you cannot access y). You could try doing a chmod a+rwx on it...

rogerdpack
A: 

I tracked it down. Sometimes it just takes someone top point out the obvious!

I have the samba share mounted on /mnt/winbox-uploads It was mounted with: dir_mode=0777,file_mode=0777 (for testing) so I assumed that the permissions were wide open. However, after checking the permissions on the /mnt/winbox-uploads directory, I saw that they were: drwxrwx---. Which basically meant, that if I was not the owner, or group, I cannot even enter the directory.

THIS HAS NOT BEEN SOLVED. SEE NOTE BELOW

Nik Petersen
Ok, False alarm. It only worked because I had unmounted the samba share. It still does not work with the directory mounted via samba.
Nik Petersen
In response to eriko: I have tried copying the files over to my linux machine. And it works great. Unfortunately this is not a good option because there is an old ASP.NET app that also needs to access those files. So, I have to store them on the windows box.... GRR.... MS is always giving me a headache
Nik Petersen
A: 

Samba mounts do not really have the same permissions that you get on a really unix like file system. Remember that samba was primarily designed for Unix system -> windows client not windows server -> unix client. Commands like chmod etc do not work very well.

Then next issue is that ruby is very un trusting of filesystems. If it feels the slightest bit uncomfortable about accessing a file it gives up. I have some rails apps that run from an nfs share that uses acls and not unix file permissions and they will not run unless I go back and give set users or groups on tmp, log, etc as ruby does not even try to look at actually to access the file if it does not see user/group permissions even though it will be successful since there are acl's.

For an answer try cloning over the files to box the rails app is running on.

eriko