The main configuration file for autofs has this entry:
What is the meaning of the /etc/auto.home file?
A. It has the indirect maps for the mounting of file systems.
B. It has configuration information, such as passwords and keys, for the remote file server.
C. It has configuration information on settings for the /home mount point.
D. It is the holds the SSL key to allow authentication to the remote file server.
题解
autofs 的主设置档(auto.master)路径为「/etc/auto.master」,可以指定一个映射档来侦测多种不同的文件来源,当这些文件来源可以访问的时候就会被自动挂载到某个指定的挂载目录(挂载点)上,该挂载目录如果不存在的话会自动产生。而映射档路径为「/etc/auto.xxx」,「xxx」可以自行决定,能够让系统管理员辨识得出来是什么就好。
参考 auto.master 的手册可以知道「/etc/auto.master」的撰写方式如下:
其中「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
所以这题的题干其实是想要让 autofs 根据「/etc/auto.home」设置档来决定要如何挂载文件系统到「/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
选项 A,正确。
选项 B,密码可以从参数代入,但密钥(SSH)似乎不行。
选项 C,单独看「/etc/auto.home」这个文件的话,它不是针对「/home」这个挂载点而存在的设置档。挂载点是在「/etc/auto.master」设置档中来决定的。
选项 D,映射档并不是用来存放密钥的文件。如果是透过 SSH 来挂载远程的文件系统(例如 sshfs),由于 autofs 是以 root 用户身份来挂载文件系统,用来认证的 SSH 私钥需要放置于「/root/.ssh」目录下(例如「/root/.ssh/id_rsa」),而「/root/.ssh/known_hosts」文件存放的是远程服务器的公钥。
