NFS:挂载时服务器拒绝访问。客户端是 LXC proxmox(!)

NFS:挂载时服务器拒绝访问。客户端是 LXC proxmox(!)

抱歉,如果这个主题与其他主题重复,但我在其中找不到答案。

我有什么:

服务器是Ubuntu 14.04.5 LTS

客户是Ubuntu 14.04.2 LTS- 即 proxmox LXC

#cat /etc/exports

/nfs        192.168.88.0/24(ro,fsid=0,insecure,no_root_squash,no_subtree_check,sync)
/nfs/keycdn 192.168.88.0/24(rw,nohide,insecure,no_root_squash,no_subtree_check,sync)

如果我从服务器运行此命令:

mount 192.168.88.185:/nfs/keycdn /mnt

它已安装并工作 - 我可以创建一个文件

如果我在客户端运行,我会收到一个错误:

root@kafka-02:/# mount 192.168.88.185:/nfs/keycdn /mnt
mount.nfs: access denied by server while mounting 192.168.88.185:/nfs/keycdn

我对文件夹有这样的权限:服务器

#ll /nfs/
drwxrwxrwx  3 nobody nogroup 4096 Mar 27 13:49 ./
drwxr-xr-x 24 root   root    4096 Mar 27 12:41 ../
drwxrwxrwx  2 nobody nogroup 4096 Mar 27 15:17 keycdn/

为了使修改 /etc/exports 后生效,我运行了 exportfs -rav 和 service nfs-kernel-server restart

我尝试在客户端的 /etc/fstab 中定义 nfs 版本。但没有效果

在服务器和客户端上运行 mount 命令的详细信息:

服务器

mount -vvvvvv 192.168.88.185:/nfs/keycdn /mnt
mount: fstab path: "/etc/fstab"
mount: mtab path:  "/etc/mtab"
mount: lock path:  "/etc/mtab~"
mount: temp path:  "/etc/mtab.tmp"
mount: UID:        0
mount: eUID:       0
mount: no type was given - I'll assume nfs because of the colon
mount: spec:  "192.168.88.185:/nfs/keycdn"
mount: node:  "/mnt"
mount: types: "nfs"
mount: opts:  "(null)"
mount: external mount: argv[0] = "/sbin/mount.nfs"
mount: external mount: argv[1] = "192.168.88.185:/nfs/keycdn"
mount: external mount: argv[2] = "/mnt"
mount: external mount: argv[3] = "-v"
mount: external mount: argv[4] = "-o"
mount: external mount: argv[5] = "rw"
mount.nfs: timeout set for Mon Mar 27 15:51:33 2017
mount.nfs: trying text-based options 'vers=4,addr=192.168.88.185,clientaddr=192.168.88.185'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.88.185'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.88.185 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.88.185 prog 100005 vers 3 prot UDP port 34598

客户版本=3

mount -o 'vers=3' -vvvvvvv 192.168.88.185:/nfs/keycdn /mnt
mount: fstab path: "/etc/fstab"
mount: mtab path:  "/etc/mtab"
mount: lock path:  "/etc/mtab~"
mount: temp path:  "/etc/mtab.tmp"
mount: UID:        0
mount: eUID:       0
mount: no type was given - I'll assume nfs because of the colon
mount: spec:  "192.168.88.185:/nfs/keycdn"
mount: node:  "/mnt"
mount: types: "nfs"
mount: opts:  "vers=3"
mount: external mount: argv[0] = "/sbin/mount.nfs"
mount: external mount: argv[1] = "192.168.88.185:/nfs/keycdn"
mount: external mount: argv[2] = "/mnt"
mount: external mount: argv[3] = "-v"
mount: external mount: argv[4] = "-o"
mount: external mount: argv[5] = "rw,vers=3"
mount.nfs: timeout set for Mon Mar 27 15:52:32 2017
mount.nfs: trying text-based options 'vers=3,addr=192.168.88.185'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.88.185 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.88.185 prog 100005 vers 3 prot UDP port 34598
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 192.168.88.185:/nfs/keycdn

版本=4

mount -o 'vers=4' -vvvvvvv 192.168.88.185:/nfs/keycdn /mnt
mount: fstab path: "/etc/fstab"
mount: mtab path:  "/etc/mtab"
mount: lock path:  "/etc/mtab~"
mount: temp path:  "/etc/mtab.tmp"
mount: UID:        0
mount: eUID:       0
mount: no type was given - I'll assume nfs because of the colon
mount: spec:  "192.168.88.185:/nfs/keycdn"
mount: node:  "/mnt"
mount: types: "nfs"
mount: opts:  "vers=4"
mount: external mount: argv[0] = "/sbin/mount.nfs"
mount: external mount: argv[1] = "192.168.88.185:/nfs/keycdn"
mount: external mount: argv[2] = "/mnt"
mount: external mount: argv[3] = "-v"
mount: external mount: argv[4] = "-o"
mount: external mount: argv[5] = "rw,vers=4"
mount.nfs: timeout set for Mon Mar 27 15:56:55 2017
mount.nfs: trying text-based options 'vers=4,addr=192.168.88.185,clientaddr=192.168.88.252'
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 192.168.88.185:/nfs/keycdn

答案1

这个答案只有当你使用 LXC proxmox 时才有帮助,但我认为你也应该在其他情况下尝试一下

问题出在 proxmox 方面。Proxmox 有 apparmor,它阻止了一切。

要停止 apparmor 并使其不工作,请执行以下步骤

# /etc/init.d/apparmor stop
# /etc/init.d/apparmor teardown
# update-rc.d apparmor disable

完成这些步骤后,一切都开始顺利进行

相关内容