English 中文(简体)
XSendFile can t stat file if on windows samba share?
原标题:

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?

问题回答

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

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

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.





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签