如果在 Windows samba 共享上,XSendFile 无法统计文件?

发布于 2024-09-16 18:52:56 字数 474 浏览 4 评论 0原文

当文件位于使用 samba 安装的目录中时,我无法让 apache 通过 XSendFile 提供文件服务。

提供一些背景知识:我有一个 Ruby on Rails 应用程序,它正在慢慢取代 ASP.NET 应用程序,并且我让它在运行 apache2 和乘客的 Linux 服务器上运行。运行 ASP.NET 代码的 Windows 计算机正在共享我通过 Samba 安装的上传目录。

每当我尝试使用 X_SENDFILE 标头发送文件时,我都会在我的 apache 服务器日志中看到以下内容:

部分结果有效,但处理不完整: xsendfile:无法统计文件:/path/to/file

但当我手动输入: stat /path/to/file 它会给我文件统计信息。我知道文件就在那里。 (我在以 apache 用户身份登录后也尝试过此操作)据我所知,文件权限是正确的。

apache 的 XSendFile 和 SMB 共享上的文件是否存在某种问题?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

找回味觉 2024-09-23 18:52:56

可能是文件/权限问题(作为用户 x,您无法访问 y)。您可以尝试对其执行 chmod a+rwx ...

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

孤云独去闲 2024-09-23 18:52:56

我追踪到了它。有时只需要有人指出显而易见的事情即可!

我将 samba 共享安装在 /mnt/winbox-uploads 上
它的安装方式为:dir_mode = 0777,file_mode = 0777(用于测试),所以我假设权限是开放的。然而,在检查/mnt/winbox-uploads目录的权限后,我看到它们是:drwxrwx---。这基本上意味着,如果我不是所有者或组,我什至无法进入该目录。

这个问题还没有解决。请参阅下面的注释

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

屌丝范 2024-09-23 18:52:56

Samba 挂载实际上并不具有与真正的 UNIX 类文件系统相同的权限。请记住,samba 主要是为 Unix 系统设计的 -> Windows 客户端不是 Windows 服务器 -> UNIX 客户端。 chmod 等命令效果不佳。

接下来的问题是 ruby​​ 非常不信任文件系统。如果它对访问文件感到有一点不舒服,它就会放弃。我有一些从使用 acls 而不是 unix 文件权限的 nfs 共享运行的 Rails 应用程序,除非我返回并在 tmp、日志等上设置用户或组,否则它们不会运行,因为 ruby​​ 甚至不尝试实际查看如果没有看到用户/组权限,则访问该文件,即使它会成功,因为有 acl。

要获得答案,请尝试克隆文件以装箱运行 Rails 应用程序。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文