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」檔案存放的是遠端伺服器的公鑰。
