Autofs 在同一文件夹中具有远程和本地主目录

oed*_*sto 6 nfs mount autofs home

我有一个 NFS 服务器为远程用户导出主目录,工作站有本地和远程用户。我想配置 autofs 将远程用户主目录挂载为 /home 目录的子目录。

我将 autofs 配置为挂载 nfs 共享,但是当挂载远程共享时,本地主目录消失了。

有没有办法只挂载 /home 目录中不存在的目录?有没有一种方法不是通过手动设置所有本地文件夹来配置的,自动发现每个存在的目录并跳过它的安装?

谢谢

Dav*_* R. 5

我刚刚解决了一个类似的问题。我想/home/usernamenfs挂载一些用户的目录,但在本地磁盘上还有其他几个。不幸的是,在尝试使用本地磁盘目录时,我遇到了权限错误。

经过一番研究,我man auto.master 5仔细阅读了一下,发现了这一点:

For direct maps the mount point is always specified as:
     /-
and the key used within the direct map is the full path to the 
mount point. The direct map may have multiple entries in the  master map.
Run Code Online (Sandbox Code Playgroud)

所以,在 auto.master 中,你会有这样的一行:

/- auto.misc --timeout 60
Run Code Online (Sandbox Code Playgroud)

在 auto.misc 中:

/home/remoteuser <options> <nfsserver>:<path to home dir>
Run Code Online (Sandbox Code Playgroud)

如果需要,您仍然可以在 auto.misc 文件中进行间接安装。只取决于您想如何组织地图文件。

请注意,这是在 Ubuntu 16.04 和自动挂载 5.1.1 上。我还没有在其他操作系统上测试过这个。