4

例如,我在 10.20.30.11 中有一个 Isilon NAS,我安装它如下:

mount 10.20.30.11:/folder /content

我可以使用ls命令在文件夹或/content. 它的模组是777。

bash-3.00# ls -l /content/a/b/1.txt

total 344131

rwxrwxrwx   1 1005     65533    140750 Feb 28 00:58 1.txt

但我无法通过 access() 函数访问它。

#include <iostream>
#include <string>
#include <unistd.h>
#include <cerrno>

using namespace std;

#include <stdio.h>
int main( int argc, const char* argv[] )
{
    int returnVal = 0;
    returnVal = access(argv[1], R_OK);
    cout << returnVal << endl;
    cout << errno << endl;
    return 0;
}

它将返回 -1 和 2 作为结果,这意味着“没有这样的文件或目录”。

./a.out /content/a/b/1.txt

-1 

2

#define ENOENT   2 /* No such file or directory */

我认为这不是权限问题,因为 mod 是 777,结果是“没有这样的文件或目录”。

4

2 回答 2

2

来自 Linux 手册页。

access() 在启用了 UID 映射的 NFS 文件系统上可能无法正常工作,因为 UID 映射是在服务器上完成的,并且对检查权限的客户端隐藏。

于 2011-03-03T03:14:11.383 回答
1

最后发现需要使用以下命令挂载Isilon存储。

mount -o vers=2,proto=tcp 1.2.3.4:/remote /mnt

The version and protocol need specified.

Thanks!

于 2011-03-10T02:58:15.953 回答