承认是有点尴尬,但我有问题让我的NFS服务器导出正确的目录。 我正在客户端和服务器上使用最新的CentOS 6.2。
服务器启动并运行,防火墙在testing过程中被禁用。
在服务器端,我创build了这个/etc/exports
:
/home/user1/documents/ *(ro,sync)
这个目录是一个软件RAID的卷的根。 输出如下:
/dev/mapper/lvm--raid-lvol0 on /home/user1/documents type ext4 (rw,nosuid,nodev)
服务器上的命令showmount -e
显示正确的输出:
Export list for servername: /home/user1/documents (everyone)
我尝试从客户端挂载该共享并获得以下输出:
mount.nfs: access denied by server while mounting servername:/home/user1/documents
然而,当我在文件/proc/fs/nfsd/exports
查看服务器后,我看到多个挂载点,但不是正确的
# Version 1.2 # Path Client(Flags) # IPs / *(ro,root_squash,sync,no_wdelay,no_subtree_check,v4root,fsid=0,uuid=696f3ea6:3d7641f3:b6315631:bd63c833) /home *(ro,root_squash,sync,no_wdelay,no_subtree_check,v4root,uuid=696f3ea6:3d7641f3:b6315631:bd63c833) /home/user1 *(ro,root_squash,sync,no_wdelay,no_subtree_check,v4root,uuid=696f3ea6:3d7641f3:b6315631:bd63c833)
这些条目来自哪里,为什么没有以/home/user1/documents
? 我尝试挂载/home/user1
而不是/home/user1/documents
从客户端,这奇怪的作品。
用户的UID在服务器和客户端上是相同的。 难道这是一个问题,要导出的目录本身被挂载?
编辑
文件/var/lib/nfs/xtab
是空的。
我看到你正在使用NFSv4(/ proc / fs / nfsd / exports输出中的fsid = 0将其提供)。 NFS根目录需要NFSv4。 这个/ etc / exports可能会更好。
/home *(ro,fsid=0) /home/user1/documents/ *(ro,sync)
您可能还需要编辑服务器和客户端的/etc/idmapd.conf中的域。
在旁注中,我强烈build议用子网replace星号,如果你不希望你的数据访问不受信任的系统。
我遇到了一个问题:
/my/dir1 *(rw,sync,fsid=0,crossmnt,no_subtree_check) /my/dir2 *(rw,sync,fsid=0,crossmnt,no_subtree_check)
并且两个mount都出现在/my/dir1
。
我正在尝试使用与Ubuntu 16.04 nfs-kernel-server
软件包/etc/exports
示例文件中给出的相同的默认选项: https : //unix.stackexchange.com/questions/198009/what-provides-etc-exports-和怎么办-我-找-即出
解决的办法是删除fsid=0,crossmnt
只使用:
/my/dir1 *(rw,sync,no_subtree_check) /my/dir2 *(rw,sync,no_subtree_check)
这也提到: https : //forums.opensuse.org/showthread.php/481263-NFS-directs-to-the-wrong-shared-folder/page2?s=ae345ec054b854b5cf036cd1816626f4