The main configuration file for autofs has this entry:



/home /etc/auto.home

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 [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

所以這題的題幹其實是想要讓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金鑰需要放置於「/root/.ssh/known_hosts」下,因為autofs是以root使用者身份來掛載檔案系統。