What is the main template file used by autofs?
A. default.maps
B. auto.conf
C. auto.master
D. autofs.master
题解
autofs 的主设置档(auto.master)路径为「/etc/auto.master」,可以指定一个映射档来侦测多种不同的文件来源,当这些文件来源可以访问的时候就会被自动挂载到某个指定的挂载目录(挂载点)上,该挂载目录如果不存在的话会自动产生。而映射档路径为「/etc/auto.xxx」,「xxx」可以自行决定,能够让系统管理员辨识得出来是什么就好。
参考 auto.master 的手册可以知道「/etc/auto.master」的撰写方式如下:
mount-point [map-type[,format]:]map [options]
其中「mount-point」若写成「/-」的话,表示要使用直接映射(direct map);如果不是的话,就是要使用间接映射(indirect map)。参考 autofs(5) 的手册可以知道「/etc/auto.xxx」文件的间接映射撰写方式如下:
kernel -ro,soft,intr ftp.kernel.org:/pub/linux
boot -fstype=ext2 :/dev/hda1
windoze -fstype=smbfs ://windoze/c
removable -fstype=ext2 :/dev/hdd
cd -fstype=iso9660,ro :/dev/hdc
floppy -fstype=auto :/dev/fd0
server -rw,hard,intr / -ro myserver.me.org:/ \
/usr myserver.me.org:/usr \
/home myserver.me.org:/home
另外,如果是直接映射的话,「/etc/auto.xxx」文件的写法就不会有「kernel」、「boot」这些关键字,而是会直接在该第一个字段上撰写挂载点的绝对路径,第二个字段上撰写要被挂载的文件路径,可以是 NFS 服务器端的文件路径。如下:
/nfs/apps/mozilla bogus:/usr/local/moxill
/nfs/data/budgets tiger:/usr/local/budgets
/tst/sbin bogus:/usr/sbin
所以答案是选项「C」。
