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」。
