5.8. 在 smb.conf.sharename 檔案中的欄位

這個部份描述 smb.conf.sharename 檔案中與高存取 性 Samba 服務的正確操作最相關的欄位。完整地說明 Samba 設定檔案的所有欄位已經超過這個文件所應含 括的範圍,在此並沒有新增任何額外的欄位以支援叢集的操作,而且這個檔案格式允許使用一般的 Samba 慣用方式。

以下為一個由 叢集設定工具 所自動產生的 smb.conf.sharename 檔案範例,這個範例顯示出一個名稱為 mktg 的共享,這個檔案的名稱為 /etc/samba/smb.conf.mktg

# Template samba service configuration file - please modify
# to specify subdirectories and client access permissions.
# Remember to copy this file over to *ALL* other cluster
# members.
#
# From a cluster perspective, the key fields are:
# lock directory - must be unique per samba service.
# bind interfaces only - must be present set to yes.
# interfaces - must be set to service floating IP address.
# path - must be the service mountpoint or subdirectory thereof.
# Refer to the cluster documentation for details.

[global]
	workgroup = RHCLUSTER
	pid directory = /var/run/samba/mktg
	lock directory = /var/cache/samba/mktg
	log file = /var/log/samba/%m.log
	encrypt passwords = yes
	bind interfaces only = yes
	interfaces = 192.168.26.11

[mktg]
	comment = High Availability Samba Service
	browsable = yes
	writable = no
	public = yes
	path = /share

以下為 /etc/samba/smb.conf.sharename 檔案中與 叢集操作最相關的欄位,在這個例子中,檔案被命名為 /etc/samba/smb.conf.mktg, 這是與執行 叢集設定工具 時所指定的共享名稱(mktg) 一致的。 以下只說明與叢集相關的欄位,其餘的欄位則遵照標準的 Samba 語法。

全域性的參數

這些參數附屬於 smb.conf.sharename 檔案中所指定的所有共享, 您可以在這個檔案中指派一個以上的共享資源,在檔案中所描述的目錄必須位於服務之檔案系統掛載上。

lock directory

指出 Samba 系統程式(smbdnmbd)將會放置它們的鎖定檔案的目錄名稱, 必須設定為 /var/cache/samba/sharename,這裡的 sharename 取決於 叢集設定工具 所指定的 參數。 指定一個鎖定目錄是必要的,如此才能允許每一服務擁有一個分開的 smbdnmbd 的實例。

pid directory

指出 Samba 系統程式(smbdnmbd)將會放置它們程序 ID 檔案 的目錄名稱,必須設定為 /var/run/samba/sharename,這裡的 sharename 取決於 叢集設定工具 所指定的 參數。 指定一個 pid 目錄是必要的,如此才能允許每一服務擁有一個分開的 smbdnmbd 的實例。

bind interfaces only

必須設定這個參數為 yes 以允許每一個 smbdnmbd 配對來繫結到與叢集 Samba 服務相關的浮動 IP 位址。

interfaces

指定與 Samba 服務相關的 IP 位址,假如在服務中指定了一個子網路遮罩,這個欄位將會如下列範例所示: interfaces = 10.0.0.10/255.255.254.0

共享特定的參數

這些參數適用於一個特定的 Samba 共享。

writable

預設情況下,共享的存取權限是保留性地設定為無法寫入,請根據您站台的特定需求來調整這個參數。

path

預設為服務設定中所指定的第一個檔案系統掛載點,應該調整這個設定以符合將要開放給用戶端當作共享資源的特定目錄或子目錄。