在文件映射中的映射项中,与映射名一起使用的特殊字符影响如何处理映射名。
文件映射中使用的映射项 +mapname 将导致自动挂载读取指定的映射,就好像该映射包含在当前文件中一样。
如果 mapname 前面没有斜杠,则 autofs 会将映射名视为字符串,并使用名称服务转换器策略查找映射名。如果路径名是绝对路径名,则 automount 将检查该名称的本地映射。
如果映射名以短划线 (-) 开头,则 automount 将访问相应的内置映射,如 hosts。
svc:system/name-service/switch 服务包含命名服务的搜索顺序。config 属性组中的 automount 属性指定了查找自动挂载项时对名称服务数据库的搜索顺序。如果未指定特定的 config/automount 属性,则会使用 config/default 属性中定义的顺序。
示例 2-2 通过 automount 命令显示映射搜索顺序# svcprop -p config svc:/system/name-service/switch config/value_authorization astring solaris.smf.value.name-service.switch config/printer astring user\ files config/default astring files\ nis config/automount astring files\ nis
该示例显示了在搜索 NIS 映射之前将先搜索本地文件中的映射。如果未指定 config/automount 属性,也会发生上述情况,因为将使用 config/default 项。因此,可以在本地 /etc/auto_home 映射中为最常访问的起始目录添加几个项。然后,可以使用转换器回退到 NIS 映射以查找其他项。
bill cs.csc.edu:/export/home/bill bonny cs.csc.edu:/export/home/bonny
搜索已包含的映射后,如果找不到匹配项,automount 将继续扫描当前映射。因此,可以在 + 项之后添加更多项。
bill cs.csc.edu:/export/home/bill bonny cs.csc.edu:/export/home/bonny +auto_home
包含的映射可以是本地文件,也可以是内置映射。只有本地文件可以包含 + 项。
+/etc/auto_mystuff # local map +auto_home # NIS map +-hosts # built-in hosts map