SMB.CONF(5) | SMB.CONF(5) |
smb.conf - Samba元件的配置檔案
smb.conf是Samba元件的配置檔案,包含Samba程式執行時的配置信 息.smb.conf被設計成可由swat (8)程式來配置和管理.本檔案包含了 關於smb.conf的檔案格式和可能出現的選項的完整描述以供參考.
本檔案由一系列段和選項構成.一個段由一對方括號中的段名開始,直到下一個段名結束.包含在段中的選項按以下格式定義:
選項名 = 選項值
本檔案是基於文字行的.這就是說,每一個以換行符結束的行描述了一個專案(註釋,段名,或選項).
段名和選項名是不區分大小寫的.
只有選項設定中的第一個等號才有意義.第一個等號前後的空格會被忽略.段名和選項名的前後以及中間包含的空格是無關的.選項值前後的空格會被忽略.選項值中包含的空格會原樣保留.
所有以';'和'#'符開頭的行都會被忽略,就象只有空格的行那樣.
按照UNIX上的慣例,以'´符號結尾的行續下一行.(也就是說:'´是續行符,如果一行寫不下,可以在行尾以'´結束,在下一行繼續寫--譯註)
等號後面跟的是字串(無需引號)或者邏輯值(可以是yes/no,1/0,或者true/false 來表示).邏輯值是不區分大小寫的.字串值則原樣保留了輸入的大小寫.某些選項 (例如create modes)的值是數值型的.
配置檔案的每一段([global]段除外)描述一項共享資源.段名就是共享名,段內的選項設定確定了該共享資源的屬性.
三個特殊段([global],[homes],[printers])將在後面'special sections'單獨說明,以下的內容是普通段的說明.
一個共享資源由一個檔案目錄和使用者對此目錄的操作許可權的說明構成.另外,還列入了一些用於內部管理的選項.
每一段定義了一項檔案服務(客戶端可以把它看作其本機檔案系統的延伸)或列印服務(客戶端可以透過它來使用伺服器提供的列印服務).
段可以定義成guest服務型別,在這種情況下,客戶無需口令就可以訪問該資源.一個特定的UNIX系統下的guest account通常用來指定這種情況下的客戶訪問許可權.
除了guest服務型別以外,其他型別的段定義的共享資源都需要口令才能訪問.使用者名稱是由客戶端提供的.由於某些老的客戶端只提供口令,沒有使用者名稱,你需要在共享定義中使用"user="選項來指定一個使用者列表,以便根據這個使用者列表進行口令驗證.對於象Windos95/98和WindowsNT這樣的現代客戶端程式,這個選項是不需要的.
注意,對於資源的操作許可權還取決於主機系統賦予指定使用者或來訪者賬戶的許可權.samba提供的服務許可權不能超出主機系統指定的許可權範圍.
下面的示範段定義了一項檔案服務,使用者擁有對/home/bar目錄進行寫操作的許可權.這個共享資源是透過共享名"foo"來訪問的.
[foo] path = /home/bar read only = no
下面示範段定義了一項列印服務,此共享資源是隻讀的,但是可以進行列印操作.也就是說,唯一允許的寫操作只能是開啟、寫入並關閉一個列印假離線檔案.其中的guest ok選項定義意味著允許以預設的guest使用者(在別處定義的)許可權進行訪問.
[aprinter] path = /usr/spool/public read only = yes printable = yes guest ok = yes
這一段中定義的選項是伺服器的全域性性設定,如果在其他段中沒有再對這些選項進行重新設定的話還可以作為它們的預設選項.更多的說明請參閱'PARAMETERS'部分的內容.
如果配置檔案中包含名為'homes'的段,就可以建立客戶到自己在伺服器上的個人目錄的連線.
當伺服器收到連線請求時,首先在已定義的段中搜索,如果段名與被請求的共享資源名一致,則該段的內容就被採用.如果沒有找到匹配的段,則被請求的資源就被當作是一個使用者名稱,同時伺服器檢視本地的口令檔案.如果該使用者名稱在口令檔案中存在且使用者給出了正確的口令,伺服器就會複製[homes]段的內容來生成一個共享資源(供該使用者訪問).
對新建共享會做以下修改:
如果要在[homes]段中定義訪問路徑path=,宏%S也許對你很有用.舉例如下:
path = /data/pchome/%S
如果你的PC 有與UNIX伺服器上個人目錄不同的目錄,象上面這樣的設定會很有用的.
這是為大量使用者提供對他們個人目錄的訪問的一種快速簡潔的辦法.
如果被請求訪問的共享資源名就是'homes',那麼,除了共享名不被改變為發出請求的使用者名稱外,其他處理過程和前面提到的過程是類似的.這種方式適合於不同使用者共享一臺終端的情況.
在[homes]段中可以定義所有普通段中可以使用的選項,可是有些選項更有意義.下面是一個實用的、典型的[homes]段的例子:
[homes] read only = no
注意,很重要的一點是:如果在[homes]段中定義了允許以guest賬戶訪問的話,任何人都可以無須口令而訪問所有賬戶的宿主目錄.也許在某些特殊情況下,這正是想要的結果,在這種情況下,你最好同時把[homes]段設定成只讀.
注意,自動的宿主目錄共享資源的可瀏覽標誌是從[global]段繼承來的,而不是[homes]段.這樣,當在[homes]段中設定browseable=no時,使用者就看不到單獨的'homes'共享,但可以看到自動的宿主目錄.
這一段很象[homes]段,不過是用於設定共享印表機的.
如果在本配置檔案中存在[printers]段,使用者就可以連線到在主機上的printcap檔案 中指定的任一印表機.
當伺服器收到連線請求時,首先在已定義的段中搜索,如果有段名與被請求的共享資源名一致,則該段的內容就被採用.如果沒有找到匹配的段,且在配置檔案中存在[homes]段,則按照前面所說的方式處理.否則,被請求的資源就被當作是一個印表機名,伺服器在適當的printcap檔案中查詢,檢驗被請求的共享資源名是否是有效的印表機共享名.如果共享名匹配,伺服器就會複製[printers]段的內容來生成一個共享列印服務.
對新建共享的修改:
注意,[printers]段必須設定為可列印,如果你不這樣設定,伺服器會拒絕裝載配置檔案.
指定的典型路徑應該設為一個公用的可寫假離線目錄(spooling)並且設定sticky標誌.一個典型的[printers]段如下所示:
[printers] path = /usr/spool/public guest ok = yes printable = yes
上臺印表機在printcap檔案中列出的所有別名都是伺服器相關的有效印表機名.如果你係統的列印子系統的工作方式不是這樣,你就必須設定一個偽printcap檔案,其中包含一行或多行如下格式的設定:
別名1|別名2|別名3|別名4...
每個別名必須是你的列印子系統可以接受的印表機名.在[global]段中指定這個新檔案作為你的printcap檔案.這個偽printcap檔案可以包含任何你要的別名,而伺服器只識別在此檔案中列出的名字.這個技術可以很方便的用於限制對本地印表機子集的訪問.
順便提一下,printcap檔案中的別名用每個記錄第一項的任何部分來定義.記錄由換行進行分隔.如果一條記錄中有多個部分,中間用"|"符號分隔.
Note
注意,在SYSV系統中,用lpstat可以確定系統中安裝了什麼樣的印表機.你可以設定"printcap name = lpstat"來自動獲得印表機列表.詳情參見"printcap name"選項.
選項定義了每個段的屬性.
有些選項是在[global]段中設定的(比如有關安全特性的設定),有些可以用在任何段中的(比如建立方式 ),剩下的就只能用在普通的段中了.在以下的描述中,[homes]和[printers]段被看作是普通段.標記(G)表示此選項只能在[global]段中使用,標記(S)表示此選項可以在服務定義段中使用.注意,有(S)標記的選項也可以用在[global]段中,在這種情況下,這個選項設定被當作所有其他段的預設設定.
選項的詳細說明是按照字母順序排列的,這樣也許不是最好的分類方式,但至少保證你可以找得到他們.如果有多個同義詞,那麼我們只對首選的那個作詳細說明,其他的同義詞都只指明參閱那個首選的選項名.
在配置檔案中可以用很多字串進行替換.例如,當用戶以john的名稱建立連線後,選項"path = /tmp/%u"就被解釋成"path = /tmp/john".
這些置換會在後面的描述中說明,這裡說明一些可以用在任何地方的通用置換.它們是:
Note that this parameter is not available when Samba listens on port 445, as clients no longer send this information
The following substitutes apply only to some configuration options(only those that are used when a connection has been established):
靈活運用這些置換和其他的smb.conf選項可以做出非常有創造性的事情來.
Samba支援"名稱修正",這樣dos和windows客戶端就可以使用與8.3格式不一致的檔案.也可以用來調整8.3格式檔名的大小寫.
有一些選項可以控制名稱修正的執行,下面集中列出來.對於預設情況請看testparm程式的輸出結果.
所有這些選項都可以針對每個服務項單獨設定(當然也可以設為全域性變數).
這些選項是:
預設情況下,Samba3.0與Windows NT相同,就是不區分大小寫但保持大小寫形式.
使用者有多種連線到服務項的方式.伺服器按照下面的步驟來確定是否允許客戶對指定服務的連線.如果下面步驟全部失敗,則拒絕使用者的連線請求.如果某一步透過,餘下的檢驗就不再進行.
如果被請求的服務項設定為guest only = yes,並且,服務執行在共享級安全模式(security = share) ,則跳過1--5步檢查.
以下列出了所有的全域性選項,各選項的詳細說明請參看後面的相應段落.注意,有些選項的意義是相同的.
以下列出了所有關於服務項的選項,各選項的詳細說明請參見後面的相應段落.注意,有些選項的意義是相同的.
This command will be run as user.
預設設定: None.
示例: abort shutdown script = /sbin/shutdown -c
預設設定: acl compatibility = Auto
示例: acl compatibility = win2k
This option is only required when using sam back-ends tied to the Unix uid method of RID calculation such as smbpasswd. This option is only available in Samba 3.0.
預設設定: add machine script = <空字串>
示例: add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
For a Samba host this means that the printer must be physically added to the underlying printing system. The add printer command defines a script to be run which will perform the necessary operations for adding the printer to the print system and to add the appropriate service definition to the smb.conf file in order that it can be shared by smbd(8).
The addprinter command is automatically invoked with the following parameter (in order):
printer name
share name
port name
driver name
location
Windows 9x driver location
All parameters are filled in from the PRINTER_INFO_2 structure sent by the Windows NT/2000 client with one exception. The "Windows 9x driver location" parameter is included for backwards compatibility only. The remaining fields in the structure are generated from answers to the APW questions.
Once the addprinter command has been executed, smbd will reparse the smb.conf to determine if the share defined by the APW exists. If the sharename is still invalid, then smbd will return an ACCESS_DENIED error to the client.
The "add printer command" program can output a single line of text, which Samba will set as the port the new printer is connected to. If this line isn't output, Samba won't reload its printer shares.
參見 deleteprinter command, printing, show add printer wizard
預設設定: none
示例: addprinter command = /usr/bin/addprinter
When executed, smbd will automatically invoke the add share command with four parameters.
configFile - the location of the global smb.conf file.
shareName - the name of the new share.
pathName - path to an **existing** directory on disk.
comment - comment string to associate with the new share.
This parameter is only used for add file shares. To add printer shares, see the addprinter command.
參見 change share command, delete share command.
預設設定: none
示例: add share command = /usr/local/bin/addshare
通常,samba伺服器需要為所有訪問伺服器上檔案的使用者建立UNIX使用者賬號.但是在使用Windows NT賬號資料庫作為主使用者資料庫的站點,建立這些使用者並在與NT的主域控制器保持使用者列表同步是一件很麻煩的事情.這個選項使smbd可以在使用者訪問時根據需要自動生成UNIX使用者賬號.
為了使用這個選項,smbd必須被設定成security=server或者security=domain,並且add user script必須設為用%u引數來建立unix帳號的指令碼檔案的全路徑,%u擴充套件成建立的unix帳號名.
當windows使用者嘗試訪問samba伺服器時,在登陸時(建立SMB協議會話),smbd與口令伺服器聯絡,並嘗試驗證使用者名稱和口令.如果成功,smbd就會根據unix的口令檔案試著將這個windows使用者對映成一個unix使用者.如果查詢失敗,但設定了add user script ,smbd就會以root的身份呼叫這個指令碼,將%u擴充套件成該要建立的使用者賬號.
如果這個指令碼執行成功,smbd就認為這個使用者已經存在.用這種方式,可以動態建立UNIX使用者賬號並匹配已有的NT賬號.
參見 security, password server, delete user script.
預設設定: add user script = <空字串>
示例: add user script = /usr/local/samba/bin/add_user %u
預設設定: add user to group script =
示例: add user to group script = /usr/sbin/adduser %u %g
小心使用該選項,因為在這個名單裡的使用者可以對共享資源作任何他們想做的事.
預設設定: 沒有 admin users
示例: admin users = jason
預設設定: afs share = no
示例: afs share = yes
The mapped user name must contain the cell name to log into, so without setting this parameter there will be no token.
預設設定: none
示例: afs username map = %u@afs.samba.org
Setting this option to a larger value could be useful to sites transitioning from WinNT and Win2k, as existing user and group rids would otherwise clash with sytem users etc.
All UIDs and GIDs must be able to be resolved into SIDs for the correct operation of ACLs on the server. As such the algorithmic mapping can't be 'turned off', but pushing it 'out of the way' should resolve the issues. Users and groups can then be assigned 'low' RIDs in arbitary-rid supporting backends.
預設設定: algorithmic rid base = 1000
示例: algorithmic rid base = 100000
如果你只需要在域中對成員提供服務資源的話這個選項是非常有用的.舉例來說,假設有兩個域DOMA和DOMB,DOMA已經向DOMB進行了委託,而samba伺服器位於DOMA中.在通常情況下,在DOMB中有賬號的使用者可以用同樣的samba伺服器賬號名訪問UNIX上的資源.而無須他在DOMA上有賬號.不過這樣就使安全界線更難分清了.
預設設定: allow trusted domains = yes
預設設定: announce as = NT Server
示例: announce as = Win95
預設設定: announce version = 4.9
示例: announce version = 2.0
Each entry in the list attempts to authenticate the user in turn, until the user authenticates. In practice only one method will ever actually be able to complete the authentication.
Possible options include guest (anonymous access), sam (lookups in local list of accounts based on netbios name or domain name), winbind (relay authentication requests for remote users through winbindd), ntdomain (pre-winbindd method of authentication for remote domain users; deprecated in favour of winbind method), trustdomain (authenticate trusted users by contacting the remote DC directly from smbd; deprecated in favour of winbind method).
預設設定: auth methods = <空字串>
示例: auth methods = guest sam winbind
預設設定: available = yes
對於名字服務,它將使nmbd 繫結到'interfaces'選項裡列出的網路介面的137和138埠上.為了讀取廣播訊息,nmbd也會繫結到"所有地址"介面(0.0.0.0)的137和138埠上.如果沒有設定這個選項,nmbd將在所有的介面上響應名字服務請求.如果設定了"bind interfaces only",那麼nmbd將在廣播介面上檢查任何分組的源地址,丟棄任何不匹配interfaces選項所列介面之廣播地址的分組.當在其它介面上收到單播分組,此選項使nmbd拒絕對任何不是是interfaces選項所列介面來發送分組的主機的服務.IP源地址哄騙可以使這個簡單的檢查失效,所以不要將nmbd安全功能用於嚴肅場合.
對於檔案服務,該選項使smbd(8)只在'interfaces'選項所列的網路介面上繫結.這就限制smbd 只響應那些介面上發出的分組.注意,不應該在PPP和時斷時續的機器上或非廣播網路介面上使用這個選項,因為它處理不了非永久連線的介面.
如果設定了bind interfaces only,除非網路地址127.0.0.1被加到interfaces選項的列表中,否則smbpasswd(8)和swat(8) 可能不會象我們所期望的那樣工作,原因如下:
為了改變使用者SMB口令,smbpasswd預設情況下會以smb客戶端的身份連線本地主機地址localhost - 127.0.0.1,發出更改口令請求.如果設定了bind interfaces only,smbpasswd在預設情況下將會連線失敗,除非127.0.0.1已被加入到interfaces選項.另外,可以用-r remote machine選項指定本地主機的主網路介面ip地址,這樣smbpasswd就會強制使用本地的主ip地址.
swat的狀態頁面會在127.0.0.1嘗試連線smbd和 nmbd,以確定它們是否正在執行.如果不加入127.0.0.1,將會使smbd和nmbd 總表示沒有執行甚至實際情況並不是這樣.這就阻止了 swat啟動/停止/重啟動smbd 和nmbd程序.
預設設定: bind interfaces only = no
如果設定了這個選項,鎖定範圍請求不能立即滿足的話,samba將會在內部對請求進行排隊,並且週期性地嘗試獲得鎖定,直到超時.
如果這個選項設定為no,samba就會同以前版本那樣,在鎖定範圍無法獲得時立即使鎖定請求失敗.
預設設定: blocking locks = yes
Changing this parameter may have some effect on the efficiency of client writes, this is not yet confirmed. This parameter was added to allow advanced administrators to change it (usually to a higher value) and test the effect it has on client write performance without re-compiling the code. As this is an experimental option it may be removed in a future release.
Changing this option does not change the disk free reporting size, just the block size unit reported to the client.
預設設定: browseable = yes
預設設定: browse list = yes
預設設定: case sensitive = no
預設設定: change notify timeout = 60
示例: change notify timeout = 300
這將把掃描時間改為每5分鐘一次.
When executed, smbd will automatically invoke the change share command with four parameters.
configFile - the location of the global smb.conf file.
shareName - the name of the new share.
pathName - path to an **existing** directory on disk.
comment - comment string to associate with the new share.
This parameter is only used modify existing file shares definitions. To modify printer shares, use the "Printers..." folder as seen when browsing the Samba host.
參見 add share command, delete share command.
預設設定: none
示例: change share command = /usr/local/bin/addshare
The LANMAN encrypted response is easily broken, due to it's case-insensitive nature, and the choice of algorithm. Clients without Windows 95/98 servers are advised to disable this option.
Disabling this option will also disable the client plaintext auth option
Likewise, if the client ntlmv2 auth parameter is enabled, then only NTLMv2 logins will be attempted. Not all servers support NTLMv2, and most will require special configuration to us it.
Default : client lanman auth = yes
If enabled, only an NTLMv2 and LMv2 response (both much more secure than earlier versions) will be sent. Many servers (including NT4 < SP4, Win9x and Samba 2.2) are not compatible with NTLMv2.
Similarly, if enabled, NTLMv1, client lanman auth and client plaintext auth authentication will be disabled. This also disables share-level authentication.
If disabled, an NTLM response (and possibly a LANMAN response) will be sent by the client, depending on the value of client lanman auth.
Note that some sites (particularly those following 'best practice' security polices) only allow NTLMv2 responses, and not the weaker LM or NTLM.
Default : client ntlmv2 auth = no
預設設定: client plaintext auth = yes
預設設定: client schannel = auto
示例: client schannel = yes
When set to auto, SMB signing is offered, but not enforced. When set to mandatory, SMB signing is required and if set to disabled, SMB signing is not offered either.
預設設定: client signing = auto
預設設定: client use spnego = yes
如果想設定機器名後的說明文字請參考 server string 命令.
預設設定: No comment string
示例: comment = Fred's Files
由於這個原因,如果在載入這個選項的時候發現配置檔名變化了,就會從新的配置檔案裡重新載入選項.
這個選項作為常用的替換非常有用.
如果這個配置檔案不存在,那麼就不會被載入.(允許你特殊地處理少數客戶的配置檔案)
示例: config file = /usr/local/samba/lib/smb.conf.%m
這個特性允許建立一個服務的'模版',可以很容易的生成相似的服務.注意,被複製的服務在配置檔案裡必須先於複製的服務出現.
預設設定: no value
示例: copy = otherservice
當生成一個檔案的時候,需要知道從dos模式對映到unix下的檔案許可權.最後的結果用這個引數進行逐位的與運算得到.這個選項可以理解成unix下檔案的位掩碼.在生成檔案的時候,任何沒有設定的位將會從建立模式中去掉.
這個選項的預設值是從unix的檔案建立模式中去掉組和其他使用者的寫和執行標誌位.
根據這個規則,samba將會把這個選項生成的unix檔案建立模式和由force create mode設定的選項進行逐位的或運算,force create mode 的預設選項是000.
這個選項不會影響目錄建立模式.細節參見directory mode .
參考force create mode以進一步瞭解在建立檔案時設定的特殊位.關於建立目錄模式參見directory mode選項.參見 inherit permissions parameter.
Note that this parameter does not apply to permissions set by Windows NT/2000 ACL editors. If the administrator wishes to enforce a mask on access control lists also, they need to set the security mask.
預設設定: create mask = 0744
示例: create mask = 0775
These values correspond to those used on Windows servers.
For example, shares containing roaming profiles can have offline caching disabled using csc policy = disable.
預設設定: csc policy = manual
示例: csc policy = programs
這可以保護伺服器不被過多的發呆連線耗盡資源.
多數客戶端有連線斷開後的自動重連功能,所以大多數情況下,這個選項對使用者應該是透明的
對多數系統建議使用較短的發呆超時的選項.
發呆超時選項被設為0意味著不會自動斷開連線..
預設設定: deadtime = 0
示例: deadtime = 15
注意要使用這個選項,必須開啟 debug timestamp選項.
預設設定: debug hires timestamp = no
注意要使用這個選項,必須開啟 debug timestamp 選項.
預設設定: debug pid = no
預設設定: debug timestamp = yes
Note that the parameter must be on for this to have an effect. 注意要使用這個選項,必須開啟 debug timestamp選項.
預設設定: debug uid = no
預設設定: default case = lower
Most problems with serving printer drivers to Windows NT/2k/XP clients can be traced to a problem with the generated device mode. Certain drivers will do things such as crashing the client's Explorer.exe with a NULL devmode. However, other printer drivers can cause the client's spooler service (spoolsv.exe) to die if the devmode was not created by the driver itself (i.e. smbd generates a default devmode).
This parameter should be used with care and tested with the printer driver in question. It is better to leave the device mode to NULL and let the Windows client set the correct values. Because drivers do not do this all the time, setting default devmode = yes will instruct smbd to generate a default one.
For more information on Windows NT/2k printing and Device Modes, see the MSDN documentation.
預設設定: default devmode = no
這個選項沒有預設值. 如果沒給出這個選項的話,對不存在的服務的請求將返回錯誤.
預設服務一般是那些允許guest ok, read-only的服務.
外在的服務名可能被替換成請求的服務名,這樣就可以用象%S這樣的宏來做一個通用的服務.
注意在預設服務選項指定的服務名裡, 字元'_'被對映為'/'. 這樣可能會出現有趣的事情.
示例:
[global] default service = pub [pub] path = /%S
For a Samba host this means that the printer must be physically deleted from underlying printing system. The deleteprinter command defines a script to be run which will perform the necessary operations for removing the printer from the print system and from smb.conf.
The deleteprinter command is automatically called with only one parameter: "printer name".
Once the deleteprinter command has been executed, smbd will reparse the smb.conf to associated printer no longer exists. If the sharename is still valid, then smbd will return an ACCESS_DENIED error to the client.
參見 addprinter command, printing, show add printer wizard
預設設定: none
示例: deleteprinter command = /usr/bin/removeprinter
這個選項對於rcs這樣的應用很有用,在這種情況下,unix檔案的屬主不允許改變許可權,dos檔案只讀.
預設設定: delete readonly = no
When executed, smbd will automatically invoke the delete share command with two parameters.
configFile - the location of the global smb.conf file.
shareName - the name of the existing service.
This parameter is only used to remove file shares. To delete printer shares, see the deleteprinter command.
參見 add share command, change share command.
預設設定: none
示例: delete share command = /usr/local/bin/delshare
預設設定: delete user from group script =
示例: delete user from group script = /usr/sbin/deluser %u %g
當遠端客戶使用'User Manager for Domains' 或是 rpcclient 從伺服器上刪除一個使用者時執行此操作。
這個指令碼刪除給定的unix使用者。
預設設定: delete user script = <空字串>
示例: delete user script = /usr/local/samba/bin/del_user %u
如果這個選項被設為了 yes,Samba將試圖遞迴刪除在被禁止目錄裡的任何檔案和目錄.這對於整合象NetAtalk這樣的檔案服務系統很有用,它通常會在目錄裡生成Dos/windows使用者看不見的中間檔案(e.g. .AppleDouble).
設定delete veto files = yes 使那些有許可權的使用者可以在刪除父目錄的時候透明的刪除子目錄.
參見 veto files 選項.
預設設定: delete veto files = no
這個設定允許用外部程式代替內部程式來計算總共的磁碟空間和可用的磁碟空間.下面的例子給出了一個能完成這個功能的指令碼.
這個外部程式的輸入是檔案系統裡一個需要計算的目錄,典型的包括./字串.以ascii碼返回兩個整數.第一個是總共的磁碟空間(以塊為單位),第二個是可用塊樹.可選的第三個返回值可以以位元組為單位給出塊的大小.預設的塊的大小是1024位元組.
注意:這個指令碼應該屬主為root,只有root可寫,並且不能帶有使用者標識位和組標識位(setuid or setgid)!
預設設定: 預設用內部程式來計算磁碟容量和可用空間.
示例: dfree command = /usr/local/samba/bin/dfree
如下這個dfree指令碼必須是可執行的.
#!/bin/sh df $1 | tail -1 | awk '{print $2" "$4}'
在Sys V一類的系統上可能是:
#!/bin/sh /usr/bin/df -k $1 | tail -1 | awk '{print $3" "$5}'
注意在特定的系統上可能需要給出相應的帶有全路徑的命令.
當生成一個路徑的時候,必須指定的目錄許可權從dos模式對映到unix模式,然後這個結果和這個選項進行逐位的與運算.這個選項可以理解成unix模式下的位掩碼.這個選項裡任何沒有設定的位在生成unix下的目錄時將會被去掉
預設情況下,這個選項把組和其他使用者的寫許可權位去掉,只允許目錄的屬主對目錄進行修改.
Samba將把這個選項和force directory mode的選項進行逐位的或運算,這個選項預設時設定為000(也就是不加額外的限制).
Note that this parameter does not apply to permissions set by Windows NT/2000 ACL editors. If the administrator wishes to enforce a mask on access control lists also, they need to set the directory security mask.
在生成目錄時如果需要設定特殊的模式位,參見force directory mode選項.
關於生成檔案時的模式位參見create mode 選項和directory security mask選項.
Also refer to the inherit permissions parameter.
預設設定: directory mask = 0755
示例: directory mask = 0775
這個選項以掩碼來實現改變許可權位,所以在修改時要防止不在掩碼中涉及的那些位.實際上,在這個掩碼中的位0可以使使用者無法改變任何東東.
如果沒有明確設定的話,這個選項會用與directory mask選項同樣的值.要允許使用者在目錄中可以修改所有的user/group/world許可權,可以把這個選項設為0777.
注意,能訪問samba伺服器的使用者透過其它方法也可以很容易地繞過這個限制,所以對獨立工作的系統來說這個選項是最根本最有用的.很多系統管理的管理員都會把它設為預設的0777.
參見 force directory security mode, security mask, force security mode 選項。
預設設定: directory security mask = 0777
示例: directory security mask = 0700
Note that clients that only support netbios won't be able to see your samba server when netbios support is disabled.
預設設定: disable netbios = no
示例: disable netbios = yes
See also use client driver
Default : disable spoolss = no
預設設定: display charset = ASCII
示例: display charset = UTF8
注意,NetBISO名的最大長度是15個字元,所以DNS名(或DNS別名)同樣最多隻能有15個字元.
nmbd 在做DNS名查詢的時候將自身複製一份,因為域名查詢是一個阻塞的動作.
參見 wins support 。
預設設定: dns proxy = yes
預設設定: domain logons = no
注意,windows NT主域控制器預設情況總是佔有這個在工作組中的特殊的NetBIOS名,宣稱自己是工作組的主域瀏覽器(也就是說,沒有什麼方法可以阻止一個Windows NT主域控制器這樣做). 這樣如果設定了這個選項,並且nmbd 在Windows NT之前向工作組宣稱了這個特殊的名字,那麼跨子網的瀏覽行為會變得奇怪,並且可能會失敗.
If domain logons = yes , then the default behavior is to enable the domain master 選項。 If domain logons is not enabled (the default setting), then neither will domain master be enabled by default.
預設設定: domain master = auto
注意,Samba對'dont descend'選項的輸入格式十分挑剔.例如他也許要求你輸入./proc而不是僅僅是/proc.實踐是最好的策略.
預設設定: none (也就是說,所有目錄的內容會正常的傳遞給客戶端)
示例: dont descend = /proc,/dev
The default depends on which charsets you have installed. Samba tries to use charset 850 but falls back to ASCII in case it is not available. Run testparm(1) to check the default on your system.
預設設定: dos filemode = no
這個選項的主要用於解決Visual C++與Samba的相容性問題.當共享檔案被鎖定時(oplocks選項被設定為允許),Visual C++使用兩個不同的讀取時間的函式呼叫來檢查檔案自從最後一次讀操作以來是否有改變.其中一個函式使用1秒的時間尺度,而另一個則使用2秒的時間尺度.由於使用基於2秒的方法要捨去任何的奇數秒,當檔案的時間記錄是奇數秒時,Visual C++的兩次函式呼叫結果就會不一致,Visual C++就會總是認為檔案被改變.設定這個選項可以使得兩次函式呼叫的結果一致,Visual C++會很高興的接受這一切.
預設設定: dos filetime resolution = no
預設設定: dos filetimes = no
預設設定: enable rid algorithm = <yes>
想要使加密口令能正確的工作, smbd(8)必須能訪問本地的smbpasswd(5)檔案(如何正確設定和維護這個檔案,請參閱smbpasswd(8)手冊),或者,設定選項security= [server|domain|ads],這樣設定將使得smbd依賴其它的伺服器來幫它鑑別口令.
預設設定: encrypt passwords = yes
The first enhancement to browse propagation consists of a regular wildcard query to a Samba WINS server for all Domain Master Browsers, followed by a browse synchronization with each of the returned DMBs. The second enhancement consists of a regular randomised browse synchronization with all currently known DMBs.
You may wish to disable this option if you have a problem with empty workgroups not disappearing from browse lists. Due to the restrictions of the browse protocols these enhancements can cause a empty workgroup to stay around forever which can be annoying.
In general you should leave this option enabled as it makes cross-subnet browse propagation much more reliable.
預設設定: enhanced browsing = yes
預設設定: no enumports command
示例: enumports command = /usr/bin/listports
這個選項的主要用於解決Visual C++與Samba的相容性問題.Visual C++生成makefiles檔案時, 包含目標檔案所依賴的目的目錄. 包含建立目錄的規則. 同樣的, 當NMAKE比較時間屬性時, 它檢查目錄建立時間. 目標目錄不存在的話, 會建立一個;如果存在,它的建立時間總是比它所包含的目標檔案的建立時間早.
UNIX的時間規則意味著只要有檔案在共享目錄中建立或刪除,Samba將更新關於該目錄建立時間的報告. NMAKE將發現目錄中除了最後建立的檔案以外的所有目標檔案都過期了(與目錄的建立時間相比較), 然後重新編譯目標檔案.設定這個選項值將保證目錄的建立時間早於它裡面的檔案,NMAKE就能夠正常工作.
預設設定: fake directory create times = no
當你設定fake oplocks = yes後,smbd(8)總是允許oplock請求, 而不管到底有多少的客戶端在使用這個檔案.
在通常情況下, 使用真實的oplocks支援總是比使用這個選項好.
如果你使用這個選項在一些只讀的共享上(例如: CDROM共享),或者你知道這個共享只能夠被一個客戶端所訪問(例如: 客戶主目錄). 你將會注意到效能上的重大提升. 如果你將這個選項用在多個客戶端都可以讀寫的共享上, 由於客戶可能同時訪問一個共享檔案, 這樣會造成檔案損壞. 請一定小心使用.
預設設定: fake oplocks = no
這個選項預設是允許(也就是, smbd將允許訪問符號連結)
預設設定: follow symlinks = yes
參見 create mask 來獲得關於建立檔案時的掩碼的詳細資料。
另外也參見 inherit permissions 引數.
預設設定: force create mode = 000
示例: force create mode = 0755
這個例子中, 將迫使所有被建立的文件對"同組/其它(使用者)"有讀和執行權. 對使用者自己有讀/寫/執行權力.
參見 directory mask 來獲得關於建立目錄時的掩碼的詳細資料。
另外也參見 inherit permissions引數.
預設設定: force directory mode = 000
示例: force directory mode = 0755
這個例子中, 將迫使所有被建立的目錄對"同組/其它(使用者)"有讀和進入權. 對使用者自己有讀/寫/進入權力.
此選項以掩碼('or')來實現許可權位的改變,所以它強制了任何掩碼中使用者可以更改的位.實際上,當在修改目錄的安全性時,這個掩碼中的一個0位可以作為一組使用者已經設為'on'的位來看待.
如果沒有明確設定的話,這個選項會用與force directory mode選項同樣的值.要允許使用者在目錄中可以修改所有的user/group/world許可權,可以把這個選項設為0000.
注意,能訪問samba伺服器的使用者透過其它方法也可以很容易地繞過這個限制,所以這個引數只對獨立工作的應用系統來說有用.很多系統管理的管理員都會把它設為預設的0000.
參見 directory security mask, security mask, force security mode 引數。
預設設定: force directory security mode = 0
示例: force directory security mode = 700
在samba 2.0.5及更新的版本中這個選項已經按下面的方法有了一些擴充套件功能.如果在此列出的組名有一個'+'字元加在名稱前的話,當前使用者正在訪問的共享資源只有初始組被預設分配到這個組中,而可能的情況是使用者已經是其它組成員了.這樣,管理員可以決定只有在特殊組裡的使用者才能以設定的組身份建立檔案,更有益於所有權分配管理.例如,設定force group = +sys的話,只有在sys組裡的使用者才能在訪問samba共享資源時擁有預設的初始組標識.而其它所有使用者保留他們原始的組標識.
如果又設定了 force user選項的話,force group選項中指定的組將會越過在 force user中指定的初始組. If the force user parameter is also set the group specified in force group will override the primary group set in force user.
參見 force user選項.
預設設定: no forced group
示例: force group = agroup
此選項以掩碼('or')來實現許可權位的改變,所以它強制了任何掩碼中使用者可以更改的位.實際上,當在修改目錄的安全性時,這個掩碼中的一個0位可以作為一組使用者已經設為'on'的位來看待.
如果沒有明確設定的話,這個選項會用與force create mode選項同樣的值.要允許使用者在檔案上可以修改所有的user/group/world許可權,可以把這個選項設為000.
注意,能訪問samba伺服器的使用者透過其它方法可以很容易地繞過這個限制,所以這個選項對獨立工作的系統來說才有用的.很多系統管理的管理員都會把它設為預設的0000.
參見 force directory security mode, directory security mask, security mask 引數。
預設設定: force security mode = 0
示例: force security mode = 700
這個選項只有當一個連線建立起來後才有用. 在建立連線的使用, 使用者還是必須有合法的使用者名稱和口令. 一旦連線建立起來, 所有的操作將強迫以這個名字進行, 而不管它是以什麼名字登入的.
samba 2.0.5和更新的版本中這個選項會導致使用者的初始組被作為所有檔案操作的初始組.2.0.5以前的初始組被允許作為聯接使用者的初始組(這是個bug)
參見 force group 選項。
預設設定: no forced user
示例: force user = auser
預設設定: fstype = NTFS
示例: fstype = Samba
This parameter should specify the path to a script that queries the quota information for the specified user/group for the partition that the specified directory is on.
Such a script should take 3 arguments:
directory
type of query
uid of user or gid of group
The type of query can be one of :
1 - user quotas
2 - user default quotas (uid = -1)
3 - group quotas
4 - group default quotas (gid = -1)
This script should print its output according to the following format:
Line 1 - quota flags (0 = no quotas, 1 = quotas enabled, 2 = quotas enabled and enforced)
Line 2 - number of currently used blocks
Line 3 - the softlimit number of blocks
Line 4 - the hardlimit number of blocks
Line 5 - currently used number of inodes
Line 6 - the softlimit number of inodes
Line 7 - the hardlimit number of inodes
Line 8(optional) - the number of bytes in a block(default is 1024)
參見 set quota command 選項。
預設設定: get quota command =
示例: get quota command = /usr/local/sbin/query_quota
預設設定: getwd cache = yes
在某些系統上,預設的訪問使用者名稱"nobody"賬戶可能不能列印.如果遇到這種情況,請使用其它的賬戶名(例如ftp)。想要測試這種情況,可以試著用來訪賬戶登入(可以用su -命令),然後,使用系統列印命令lpr(1)或lp(1).
這個引數不接受%宏,因為Samba系統的很多元件要正確工作都需要這個值是一個常量。
預設設定: 編譯時指定,通常是"nobody"
示例: guest account = ftp
這個選項抵消了設定 restrict anonymous = 2 的好處。
參見下面的 security來獲得更多資訊。
預設設定: guest ok = no
參見下面的 security 引數來獲得更多資訊。
預設設定: guest only = no
預設設定: hide dot files = yes
每個條目必須以"/"分隔以便允許在條目中使用空格.可以使用DOS風格的萬用字元"*"和"?"匹配多個目錄和檔案。
每一個條目必須使用UNIX格式的路徑,而不是DOS格式的路徑,同時,不能包含UNIX路徑分隔符"/".
注意:大小寫敏感的特性也適用於隱含檔案.
設定這個選項會影響Samba的效能,它會迫使系統檢查所有的檔案和目錄以確定是否與它的所要尋找的專案匹配.
參見 hide dot files, veto files 和 case sensitive.
預設設定: 沒有隱藏檔案
示例: hide files = /.*/DesktopFolderDB/TrashFor%m/resource.frk/
上面的例子中的檔案從Thursby共享出來,給Macintosh的SMB客戶端(DAVE),供內部使用,仍然隱藏了"."打頭的檔案.
預設設定: hide local users = no
預設設定: hide special files = no
預設設定: hide unreadable = no
預設設定: hide unwriteable = no
username server:/some/file/system
程式從":"號前取得伺服器名字.將來也許會有更好的解釋系統來處理不同的對映格式,當然,也包括Amd(另一種自動裝載方式)對映.
需要系統中有一個執行的NIS客戶來使這個選項工作。
參見 nis homedir , domain logons .
預設設定: homedir map = <空字串>
示例: homedir map = amd.homedir
參見 msdfs root share level 選項。 For more information on setting up a Dfs tree on Samba, refer to ???.
預設設定: host msdfs = no
預設設定: hostname lookups = yes
示例: hostname lookups = no
這個選項是一個由逗號,空格或者tab字元隔開的一組主機名.列入其中的主機才允許訪問.
如果該選項出現在[global]段中,它會作用於所有服務而忽略單個服務所作的不同設定.
你可以用ip地址或主機名來指定主機.比如,你可以用類似 allow hosts = 150.203.5. 來限定只允許訪問在這個c類子網中的主機.hosts_access(5)中詳細描述了關於這個選項設定的完整語法.注意到你的系統中也許沒有這個參考手冊,這裡也作一個簡單的說明.
注意,本機地址127.0.0.1 總是允許連線,除非在hosts deny 選項中加以禁止.
你也可以使用子網號/子網掩碼對來指定主機.如果你的網路支援網路組,你還可以用網路組名來指定組內的主機.EXCEPT(除了...)關鍵字可以在使用了萬用字元的情況下起到限定作用.
Example 1: 允許150.203.*.* 中除了一臺機器之外的所有IP訪問
hosts allow = 150.203. EXCEPT 150.203.6.66
Example 2: 允許滿足給定的子網號/子網掩碼的IP訪問
hosts allow = 150.203.15.0/255.255.255.0
Example 3: 允許一系列主機訪問
hosts allow = lapland, arvidsjaur
Example 4: 允許NIS網路組"foonet"訪問,但是禁止其中的一臺主機
hosts allow = @foonet
hosts deny = pirate
注意,訪問時還是需要有適當的使用者級口令.
參見testparm(1) 來檢測主機是否可以按照你希望的方式被訪問.
預設設定: none (也就是說,所有機器都可以訪問)
示例: allow hosts = 150.203.5. myhost.mynet.edu.au
預設設定: none (沒有禁止訪問的主機)
示例: hosts deny = 150.203.4. badhost.mynet.edu.au
不要把這個選項和hosts allow 搞混了,那是關於控制主機對服務的訪問的,用於管理對來訪者的服務.而 hosts equiv是用於支援那些不對samba提供口令的NT客戶的.
注意:使用hosts equiv 可能會成為一個很大的安全漏洞.這是因為你相信發起訪問的PC提供了正確的使用者名稱.找一臺PC來提供一個假的使用者名稱是很容易的.我建議你只有在完全明白你在幹什麼的情況下才使用hosts equiv選項,或者在你自己的家裡(那裡有你可以完全信任的配偶和孩子)使用它.僅僅是在你完全可以信任他們的時候才用 :-)
預設設定: no host equivalences
示例: hosts equiv = /etc/hosts.equiv
預設設定: idmap backend = <空字串>
示例: idmap backend = ldap:ldap://ldapslave.example.com
The availability of an idmap gid range is essential for correct operation of all group mapping.
預設設定: idmap gid = <空字串>
示例: idmap gid = 10000-20000
預設設定: idmap uid = <空字串>
示例: idmap uid = 10000-20000
它支援標準替換,除%u , %P 和 %S以外.
預設設定: 沒有包含其他檔案
示例: include = /usr/local/samba/lib/admin_smb.conf
預設設定: inherit acls = no
New directories inherit the mode of the parent directory, including bits such as setgid.
New files inherit their read/write bits from the parent directory. Their execute bits continue to be determined by map archive , map hidden and map system as usual.
Note that the setuid bit is never set via inheritance (the code explicitly prohibits this).
This can be particularly useful on large systems with many users, perhaps several thousand, to allow a single [homes] share to be used flexibly by each user.
參見 create mask , directory mask, force create mode and force directory mode .
預設設定: inherit permissions = no
這個選項的內容是一個介面字串的列表, 每個字串可以是下列任何一種格式:
一個網路介面名(例如eth0).它可以包含象在shell風格的萬用字元如eth*來匹配任何以子字元品"eth"起始的網路介面.
一個IP地址.這種情況下,網路掩碼是從核心中獲得的介面列表中檢測的.
一個IP/掩碼對.
一個廣播地址/掩碼對.
"mask"選項可以是一個位長度(例如C類網路可以是24)或者是以點分格式出現的完整網路地址掩碼.
"IP"選項可以是完整點分十六進位制IP地址或是按作業系統通常使用的主機名解析機制查詢的主機名.
例如,下面這一行:
interfaces = eth0 192.168.2.10/24 192.168.3.10/255.255.255.0
將配置三個網路介面,對應eth0裝置以及IP地址192.168.2.10 和192.168.3.10。後兩個介面的網路掩碼將設定為255.255.255.0。
參見bind interfaces only.
預設設定: 除了127.0.0.1 之外的所有活動介面 that are broadcast capable
以@開頭的使用者名稱首先被當作NIS網路組名(如果你的系統支援NIS的話),如果在NIS的網路組資料庫中找不到這個組,那麼這個名字就被當作一個UNIX使用者組名來處理.
以+開頭的使用者名稱僅表示UNIX使用者組名,以&開頭的使用者名稱僅表示NIX網路組名(這個設定要求你的系統中有NIS在執行).'+'和'&'符號可以以任何順序出現在使用者組名前,因此,你可以指定對這個名稱的查詢次序,比如+&group表示先在UNIX使用者組中查詢,再在NIS網路組中查詢,而&+group則相反,先在NIX網路組中查詢,再到UNIX使用者組中查詢.(這與使用@字首的效果相同).
當前的服務名可以用%S來表示,這在[homes]段中是很有用的.
參見 valid users .
預設設定: 沒有非法使用者
示例: invalid users = root fred admin @wheel
通常,如果用於連線的socket使用了SO_KEEPALIVE屬性設定(參見socket options),那麼傳送保持連線的包是不需要的.基本上,除非你遇到了某些困難,這個選項是用不到的.
預設設定: keepalive = 300
示例: keepalive = 600
This parameter is only usd when your kernel supports change notification to user programs, using the F_NOTIFY fcntl.
預設設定: Yes
核心機會性鎖定操作使得本地UNIX程序或NFS對檔案進行操作時可以鎖定(凍結)smbd(8)對同一個檔案的oplocks 操作.這可以保持SMB/CIFS,NFS和本地檔案操作之間的資料一致性.(這是一個很cool的特性哦 :-)
如果你的系統支援這個設定,預設設定就是on(開啟),如果系統不支援,預設設定就是Off(關閉).你根本不必去管這個選項.
參見 oplocks 和 level2 oplocks 引數.
預設設定: kernel oplocks = yes
The LANMAN encrypted response is easily broken, due to it's case-insensitive nature, and the choice of algorithm. Servers without Windows 95/98 or MS DOS clients are advised to disable this option.
Unlike the encypt passwords option, this parameter cannot alter client behaviour, and the LANMAN response will still be sent over the network. See the client lanman auth to disable this for Samba's clients (such as smbclient)
If this option, and ntlm auth are both disabled, then only NTLMv2 logins will be permited. Not all clients support NTLMv2, and most will require special configuration to us it.
Default : lanman auth = yes
預設設定: large readwrite = yes
預設設定: ldap delete dn = no
預設設定: ldap filter = (&(uid=%u)(objectclass=sambaAccount))
預設設定: none
示例: dc=samba,ou=Groups
預設設定: none
示例: ou=Idmap,dc=samba,dc=org
預設設定: none
The ldap passwd sync can be set to one of three values:
Yes = Try to update the LDAP, NT and LM passwords and update the pwdLastSet time.
No = Update NT and LM passwords and update the pwdLastSet time.
Only = Only update the LDAP password and let the LDAP server do the rest.
預設設定: ldap passwd sync = no
這個選項控制用於和LDAP伺服器通訊的tcp埠號。預設應用標準的LDAP埠636。
參見: ldap ssl
Default : ldap port = 636 ; 如果 ldap ssl = on
Default : ldap port = 389 ; 如果 ldap ssl = off
這個選項應當包含ldap目錄伺服器的FQDN,用來查詢和定位使用者帳戶資訊。
Default : ldap server = localhost
The ldap ssl can be set to one of three values:
Off = Never use SSL when querying the directory.
Start_tls = Use the LDAPv3 StartTLS extended operation (RFC2830) for communicating with the directory server.
On = Use SSL on the ldaps port when contacting the ldap server. Only available when the backwards-compatiblity --with-ldapsam option is specified to configure. See passdb backend
Default : ldap ssl = start_tls
預設設定: none
預設設定: none
2級,或者只讀oplocks允許Windows NT客戶在檔案中可以保持一個oplocks,一旦第二個使用者請求同一檔案時可以從讀寫oplocks級降為只讀oplocks(而不是像傳統的做法,保持唯一的oplocks,在第二次開啟時釋放所有的oplocks).這樣就可以允許支援2級oplocks的檔案開啟者快取用於只讀的檔案(也就是說,他們的寫和鎖定請求不可能被緩衝),並且使只讀檔案的大量訪問提升效能(例如.exe檔案).
一旦在擁有隻讀oplocks的客戶中有一位對檔案進行了寫操作,所有的客戶都會被通知(不需要回復及等待), told to break their oplocks to "none",然後刪除所有read-ahead caches.
推薦開啟這個選項,為共享的可執行程式提高訪問速度。
更多關於2級oplocks的討論請檢視CIFS的規約.
當前,如果使用了kernel oplocks的話,就不會認可2級oplocks(即使把那個選項設為yes也沒用).還要注意,oplocks 選項必須在共享上被設成yes才有效果.
參見 oplocks 和 kernel oplocks 選項。
預設設定: level2 oplocks = yes
參見 lm interval.
預設設定: lm announce = auto
示例: lm announce = yes
參見lm announce.
預設設定: lm interval = 60
示例: lm interval = 120
預設設定: load printers = yes
設定這個值為 no 將使 nmbd 永遠不會 成為主控瀏覽器。
預設設定: local master = yes
預設設定: lock directory = ${prefix}/var/locks
示例: lock directory = /var/run/samba/locks
如果 locking = no ,所有的鎖定請求和解除鎖定請求將表現為成功執行.對鎖定的查詢將會顯示沒有鎖定.
如果locking = yes 伺服器將執行真正的鎖定。
這個選項可能對只讀檔案系統有用,因為它可能不需要鎖定(例如:CDROM).即使在這種情況下,我們也不真正推薦使用no.
要特別小心,不管是全域性的關閉這個選項或者在某個服務上關閉這個選項,都有可能由於缺少鎖定而導致資料損壞.其實,你根本就不需要設定這個選項.
預設設定: locking = yes
預設設定: lock spin count = 3
預設設定: lock spin time = 10
這個選項支援標準的檔名代換變數,允許方便的為每個使用者或者機器設定專用的日誌檔案.
示例: log file = /usr/local/samba/var/log.%m
預設的除錯水平將在命令列裡定義,如果沒有定義,除錯水平為零.
示例: log level = 3 passdb:5 auth:10 winbind:2
注意:這個選項只有在Samba是登入伺服器時才有用.
預設設定: logon drive = z:
示例: logon drive = h:
C:\> NET USE H: /HOME
這樣的命令。
這個選項支援標準的命令選項替換,方便為每個使用者或者機器提供登入指令碼.
This parameter can be used with Win9X workstations to ensure that roaming profiles are stored in a subdirectory of the user's home directory. This is done in the following way:
logon home = \%NUrofile
This tells Samba to return the above string, with substitutions made when a client requests the info, generally in a NetUserGetInfo request. Win9X clients truncate the info to \\server\share when a user does net use /home but use the whole string when dealing with profiles.
Note that in prior versions of Samba, the logon path was returned rather than logon home. This broke net use /home but allowed profiles outside the home directory. The current implementation is correct, and can be used for profiles if you use the above trick.
注意,這個選項只在Samba被設定成為登入伺服器logon server時才起作用.
預設設定: logon home = "\%NU"
示例: logon home = "\remote_smb_serverU"
這個選項支援標準替換,允許你為每一個使用者或機器設定不同的登入指令碼.它也可以指定那些顯示在Windows NT客戶端上的"應用程式資料"(桌面,開始選單,網路上的芳鄰和程式等資料夾和他們的內容).
指定的共享資源和路徑必須是使用者可讀的,這樣,設定的選項和目錄才能被Windows NT客戶端裝載使用.這個共享資源在使用者第一次登入時必須是可寫的,這樣Windows NT客戶端才能建立NTuser.dat檔案及其他目錄.
然後,這些目錄以及其中的任何內容都可以根據需要設定為只讀的.把NTuser.dat檔案設定成只讀是不明智的,你應該把它改名成NTuser.man(一個強制使用(MANdatory)的user.dat)來達到同樣的目的.
Windows終端有時候即使沒有使用者登入也會保持對[homes]共享資源的連線.因此,logon path不能包含對homes共享資源的任何參照(也就是說,把這個選項設定成類似\\%N\HOMES\profile_path會引起問題).
這個選項支援標準替換,允許你為不同的機器或使用者設定不同的登入指令碼.
注意,這個選項只有在Samba被設定成為登入伺服器logon server的時候才起作用.
預設設定: logon path = \\%N\%U\profile
示例: logon path = \\PROFILESERVER\PROFILE\%U
指令碼檔案的存放位置必須是相對於[netlogon]服務中指明的目錄路徑,舉例來說,如果[netlogon]服務指定了了一個path是/usr/local/samba/netlogon,而logon script = STARTUP.BAT, 那麼將要下載到客戶端執行的檔案的實際存放位置是:
/usr/local/samba/netlogon/STARTUP.BAT
登入指令碼的內容包含什麼,完全由你決定.我們建議包含這個指令:NET TIME \SERVER /SET /YES,它強迫每一臺機器的時間和伺服器的時間同步(以伺服器的時間為準);另一個建議是對映公共工具盤:NET USE U:\\SERVER\"公共工具目錄" 例如:
NET USE Q:\SERVERISO9001_QA
注意:在一個有安全要求的系統環境中,特別重要的是要記住不要允許客戶在[netlogon]上有寫的許可權,也不要給以客戶改寫登入指令碼檔案的權利.如果允許客戶隨意的修改,安全規則就給撕裂了一個口子.
這個選項支援標準的置換規則,允許你為每個不同的使用者或機器定製不同的登入指令碼.
注意,這個選項只有在Samba設定為登入伺服器時才起作用.
預設設定: no logon script defined
示例: logon script = scriptsU.bat
這個指令應該是一個可以根據印表機名和作業號中斷列印作業的程式或指令碼.實現這個操作的一個辦法是使用作業優先順序,優先級別太低的作業不會被髮送到印表機上.
用%p置換可以取得印表機名,而%j會被列印作業號(一個整數)置換.在HPUX系統中(參見printing=hpux ),如果給lpq命令加上-p%p選項,列印作業會顯示其執行狀態,具體的說,如果作業的優先順序低於阻塞級別,它會顯示'PAUSED'狀態,反之,如果作業的優先順序等於或高於阻塞級別,它會顯示'SPOOLED'或'PRINTING'狀態.
注意,在這個設定中使用絕對路徑是一個好習慣,因為這個路徑有可能不在伺服器的PATH環境變數中.
參見 printing parameter選項.
預設設定: 目前這個選項沒有預設設定,除非printing選項設定SYSV,在這種情況下,預設參 數是:
lp -i %p-%j -H hold
或者在printing選項設定為softq時,預設選項是:
qstat -s -j%j -h
在HPUX系統中的例子: lppause command = /usr/bin/lpalt %p-%j -p0
緩衝檔案被存放在/tmp/lpq.xxxx檔案中,其中的xxxx是正在使用的lpq命令雜湊表.
這個選項的預設值是10秒,這就是說以前相同的lpq命令的緩衝內容將在週期為10秒內被使用.如果lpq命令非常慢的話,可以取稍大的值.
把這個值設為0就完全禁止了緩衝技術的使用.
參見 printing 選項.
預設設定: lpq cache time = 10
示例: lpq cache time = 30
這個命令應該是一個只以印表機名作為選項並可以輸出印表機狀態資訊的程式或指令碼.
通常支援九種印表機狀態資訊:CUPS, BSD,AIX,LPRNG,PLP,SYSV,HPUX,QNX和SOFTQ.而這些正好覆蓋了大多數的UNIX系統.你可以用printing =選項來控制到底要用哪種型別.
有些客戶端(特別是Windows for Workgroups)可能不能正確地向列印機發送聯接號以獲得狀態資訊.對此,伺服器會向客戶報告它所聯接的首個列印服務.這樣的情況只當聯接號傳送非法時才會發生.
如果使用%p變數的話,系統會在此處放置印表機名.否則在命令後放置印表機名.
注意,當伺服器不能獲得PATH變數的話,以絕對路徑來描述lpq command是個好習慣. 當與CUPS庫編譯連線時,不需要lpq command,因為smbd將使用庫呼叫來獲得列印佇列列表。
參見 printing 選項.
預設設定: 依賴於 printing 的設定情況
示例: lpq command = /usr/bin/lpq -P%p
此命令應該是一個以印表機名和要恢復的列印任務號作為選項的程式或指令碼.參見lppause command 引數。
如果使用%p變數的話,系統會在此處放置印表機名.用%j來代替列印任務號,當然是用整數形 式羅.
注意,當伺服器不能獲得PATH變數的話,以絕對路徑來描述lpresume command是個好習慣
參見 printing 選項.
預設設定: 當前沒有預設設定,除非 printing 選項是 SYSV, 此時預設是
lp -i %p-%j -H resume
或者如果printing 選項是 SOFTQ, 那麼預設是:
qstat -s -j%j -r
HPUX的示例: lpresume command = /usr/bin/lpalt %p-%j -p2
此命令應該是一個使用印表機名和列印任務號的程式或指令碼,並且執行它們可以刪掉列印任務.
如果使用%p變數的話,系統會在此處放置印表機名.用%j來代替列印任務號,當然是也用整數形式羅.
注意,當不能從伺服器獲得PATH變數的話,以絕對路徑來描述lprm command是個好習慣.
參見printing 選項.
預設設定: 依賴於 printing 選項設定
示例 1: lprm command = /usr/bin/lprm -P%p %j
示例 2: lprm command = /usr/bin/cancel %p-%j
參見 smbpasswd(8), 和 security = domain 選項.
預設設定: machine password timeout = 604800
警告:如果兩個客戶在同樣的目錄下用相同的magic script,輸出檔案內容是無法確定的.
預設設定: magic output = <magic script name>.out
示例: magic output = myfile.txt
以這種方式執行的指令碼將會在完成以後被刪除,只要許可權允許的話.
如果指令碼產生了輸出的話,這些資訊就被送到magic output選項指定的檔案中(見以上描述).
注意,一些命令直譯器不能解釋包含CR/LF而不是CR回車換行符的指令碼.magic指令碼必須是可以被執行的(就象在本地主機執行一樣),而有些指令碼在某些主機上或某些shell下可能會在dos客戶端進行過濾處理.
magic指令碼仍處於實驗階段,所以不能對此完全依賴.
預設設定: 無。禁止使用magic script.
示例: magic script = user.csh
預設設定: mangle case = no
所以如果要將 html 對映為 htm 你應當這樣:
mangled map = (*.html *.htm)
有一個非常有用的經驗是刪掉在CDROM光碟上一些檔名後面討人厭的;1(只有在一些UNIX可以看到它們).為此可以這樣對映:(*;1 *;).
預設設定: 沒有 mangled map
示例: mangled map = (*;1 *;)
NAME MANGLING部分有更多關於如何控制這類處理的詳細資訊.
如果使用了這種對映,那麼其演算法就象下面這樣:
把檔名最後一個點符號前面首五個字母數字字元強制轉換成大寫,作為要對映名字的首五個字元.
在要對映名字的起始部分加上"~"符號,後面跟兩個字元的特殊序列字串,而這個序列字串是由原始的檔名而來(也就是:原檔名去掉最後的副檔名).只有當檔案的副檔名含有大寫字母或長於三個字元時,檔案的最後副檔名才被包含在雜湊計算中.
注意,如果你不喜歡'~'的話,可以用mangling char選項來指定你想要的字元.
最後,副檔名部分的前三個字元會被保留,強制轉換到大寫並作為對映後名字的副檔名.最後的副檔名就是原始檔名中最後一個'.'右面的那部分.如果檔名中沒有'.',那麼對映後的檔名也沒有副檔名部分(除非用了"hidden files" - 參見後面的介紹).
unix的檔名如果以點開始,那麼好比DOS中的隱藏檔案.這些檔案對映後的檔名就會拿掉點符號並用"___"來作為它的副檔名,而不管原來的副檔名是什麼("___"是三個下劃線).
大寫字母數字字元組成了兩位雜湊值.
如果目錄中的檔案與要對映的檔名使用了相同的前五位字元,這樣的演算法會導致名稱衝突,不過發生衝突的可能性是1/1300.
名稱對映允許當需要保留unix長檔名時在unix目錄與Windows/DOS之間複製檔案.從Windows/DOS中拷過來的unix檔案可以更換新的副檔名並保留同樣的主檔名.名稱對映並不會在轉換時更改什麼東西.
預設設定: mangled names = yes
棧裡儲存了最近對映的基本檔名(副檔名只有在超過3個字元或者包含大寫字元時才會保留).
棧值設得稍大一些,對於對映unix的長檔名操作會更順利一些.但是,它會使目錄訪問變得更慢;小一些的棧可以儲存在伺服器的記憶體中(每個棧元素佔256個位元組).
並不保證在轉換長檔名時絕對正確無誤,準備好面對可能出現的驚奇.
預設設定: mangled stack = 50
示例: mangled stack = 100
mangle prefix is effective only when mangling method is hash2.
預設設定: mangle prefix = 1
示例: mangle prefix = 4
預設設定: mangling char = ~
示例: mangling char = ^
預設設定: mangling method = hash2
示例: mangling method = hash
預設設定: map acl inherit = no
注意這個選項需要在create mask[u4E2D]沒有排除檔案屬主的執行許可權位(也就是說它必須包含100).參見create mask選項中的描述.
預設設定: map archive = yes
注意這個選項需要在create mask中沒有排除所有使用者的執行許可權位(也就是說它必須包含001).參見create mask選項中的描述.
預設設定: map hidden = no
注意這個選項需要在create mask中沒有排除組使用者的執行許可權位(也就是說它必須包含010).參見create mask選項中的描述.
預設設定: map system = no
這時,選項會有三種不同的值,分別通知smbd(8)在使用者以非法身份登入時作何相應處理.
這三種設定是:
Never - 意思是使用者登入時用了個非法口令並且被伺服器所拒.這是個預設值.
Bad User - 意思是使用者登入時用了非法口令並且被伺服器所拒,除非使用者名稱不存在,否則也可以以來賓身份登入並對映到對應的guest account賬號.
Bad Password - 意思是使用者登入時即使用了非法口令,但是還會以來賓身份登入並對映到對應的guest賬號.可能出現這樣的問題,就是使用者雖然輸錯了口令,卻非常平靜地以“來賓”身份登入到系統上。他們不明白為什麼他們不能訪問那些他們認為可以訪問的資源,因為在登入時沒有任何資訊提示他們輸錯了口令。所以應該小心使用它,以避免不必要的麻煩. Helpdesk services will hate you if you set the map to guest parameter this way :-).
注意當使用共享級以外的其它安全模式時,要設定這個選項,以使"Guest"共享資源服務發揮作用.因為在這些安全級模式中,使用者請求的共享資源名在伺服器成功驗證使用者登入前不會傳送到伺服器作處理,所以伺服器就在不能處理聯接驗證結果時為聯接提供"Guest"共享.
對於那些以前的版本,這個選項會對映到編譯時所用的local.h檔案裡定義的GUEST_SESSSETUP變數的值.
預設設定: map to guest = Never
示例: map to guest = Bad User
為了實現這樣的功能,系統會使用記錄鎖定檔案.鎖定檔案存放在lock directory選項指定的目錄中.
預設設定: max connections = 0
示例: max connections = 10
注意這個選項並不是限制管理員往磁碟上存放資料的容量.在上面所說的情況中,管理員仍然可以存放超過100M的資料到磁碟上,但如果客戶查詢剩餘磁碟空間或磁碟總空間的話,所得到的結果就只在這個 max disk size指定的容量範圍之內.
使用這個選項主要是為了對一些瘋狂使用磁碟空間的軟體進行一定的限制,特別是它們可能會使用超過1G上以的磁碟空間.
把這個選項設為0說明沒有限制.
預設設定: max disk size = 0
示例: max disk size = 1000
把這個選項設為0說明沒有限制.
預設設定: max log size = 5000
示例: max log size = 1000
預設設定: max mux = 50
開啟檔案極限通常用UNIX每程序最大檔案描述符數來限制更好,所以你不需要去碰這個選項的.
預設設定: max open files = 10000
預設設定: max print jobs = 1000
示例: max print jobs = 5000
可能的值是:
CORE: 早期版本,不接受使用者名稱.
COREPLUS: 在CORE的基礎上改進了一些效能.
LANMAN1: 第一個比較流行的協議,支援長檔名.
LANMAN2: 對LANMAN1進行了更新.
NT1: 目前用於Windows NT,一般稱為CIFS.
通常,此選項不必設定,因為在SMB協議中會自動協商並選擇合適的協議.
參見 min protocol
預設設定: max protocol = NT1
示例: max protocol = LANMAN1
預設設定: max reported print jobs = 0
示例: max reported print jobs = 1000
預設設定: max smbd processes = 0 ## no limit
示例: max smbd processes = 1000
預設設定: max ttl = 259200
參見 min wins ttl 選項.
預設設定: max wins ttl = 518400
預設設定: max xmit = 65535
示例: max xmit = 8192
通常這個命令所做之事都取決於你的想象.
例如:
message command = csh -c 'xedit %s;rm %s' &
這個命令用xedit發出一條資訊,然後再刪除它.注意很重要的一點是這個命令應該立即返回.這就是為什麼在行末用'&'的原因.如果它沒有立即返回的話,計算機可能會在傳送資訊時當掉的(不過一般都會在30秒後恢復).
所有資訊都被以全域性訪客使用者身份傳送.命令可以使用標準的替換符,不過%u將不會有效(在這裡用%U可能更好).
除了標準替換的部分,還可以應用一些附加的替換,比如:
%s =包含訊息的檔名
%t = 傳送資訊的目標(很可能是伺服器名).
%f = 資訊的來源.
你可以用這個命令來發送郵件或者你想要的內容.如果你有關於傳送內容的好主意請通知開發人員.
有個例子可以以郵件形式傳送資訊給root:
message command = /bin/mail -s 'message from %f on %m' root < %s; rm %s
如果沒有指定傳送資訊所用的命令,那麼這個資訊並不會被髮出,同時Samba向傳送者報告出錯.不幸的是WfWg(Windows for Workgrups)完全忽略出錯程式碼,提示資訊已被髮出.
如果你想要悄悄地刪掉它的話請用:
message command = rm %s
預設設定: 沒有 message command
示例: message command = csh -c 'xedit %s; rm %s' &
參見 unix password sync, passwd program和 passwd chat debug 選項.
預設設定: min password length = 5
參見 printing 選項。
預設設定: min print space = 0
示例: min print space = 2000
If you are viewing this parameter as a security measure, you should also refer to the lanman auth 選項。 Otherwise, you should never need to change this 選項。
Default : min protocol = CORE
Example : min protocol = NT1 # disable DOS clients
預設設定: min wins ttl = 21600
Only Dfs roots can act as proxy shares. Take a look at the msdfs root and host msdfs options to find out how to set up a Dfs root share.
示例: msdfs proxy = \\otherserver\someshare
參見 host msdfs
預設設定: msdfs root = no
預設設定: name cache timeout = 660
示例: name cache timeout = 0
這些名字解析選項是:"lmhosts","host","wins"和"bcast".它們決定了名字解析是以如下方式的:
lmhosts : 在samba的lmhosts檔案中查詢IP地址.如果lmhosts檔案的內容行中沒有名字型別附加在NetBIOS名上時(參見lmhosts (5)中的詳細描述),任何型別的名字都可以匹配這個查詢.
host : 執行標準的主機名到IP地址的解析操作,此操作會使用系統的/etc/hosts,NIS或者是DNS來查詢.具體方法取決於作業系統,在IRIX和Solaris中解析名字的方法可能是由/etc/nsswitch.conf檔案來控制的.注意此方法只適用於對被查詢的NetBIOS名字型別為0x20(伺服器)或者是0x1c(域控制器)時才有用,其它型別都會被忽略.後一種情況只在活動目錄域中有用,返回一個匹配_ldap._tcp.domain 的SRV RR條目的DNS 查詢。
wins : 向列在wins server選項中的伺服器查詢一個名字對應的IP地址.如果沒有指定WINS伺服器,那麼此方法就被略過了.
bcast : 向在interfaces選項中列出的每一個已知本地網路介面進行廣播來作查詢.這是最不可信的名字解析方法,除非目標主機就在本地子網中.
預設設定: name resolve order = lmhosts host wins bcast
示例: name resolve order = lmhosts bcast host
在上例中首先檢查本地lmhosts檔案,然後嘗試廣播,接下來就是用通常的系統主機名查詢方式了.
When Samba is functioning in ADS security mode (security = ads) it is advised to use following settings for name resolve order:
name resolve order = wins bcast
DC lookups will still be done via DNS, but fallbacks to netbios names will not inundate your DNS servers with needless querys for DOMAIN<0x1c> lookups.
參見 netbios name 選項。
預設設定: 空字串 (沒有附加的名字)
示例: netbios aliases = TEST TEST1 TEST2
參見 netbios aliases 選項
預設設定: machine DNS name
示例: netbios name = MYNAME
如果samba登入伺服器不是作為真正主目錄伺服器而是透過NFS來實現,卻通知使用者以SMB伺服器來使用主目錄時,使用者裝載主目錄來進行訪問需要兩個網路跳步(一個以SMB方式,另一個以NFS方式裝載).這樣的使用方式是非常慢的.
此選項允許當Samba在主目錄伺服器方式執行時讓samba反饋目錄伺服器而非登入伺服器上的主共享資源,這樣samba使用者可以直接從目錄伺服器上裝載目錄.當samba把目錄共享資源反饋給使用者,這時它會參考homedir map選項指定的NIS對映表然後再反饋表中列出的服務.
注意要使此項起作用必須有一個運作中的NIS系統,並且samba伺服器必須是一個登入伺服器。
預設設定: nis homedir = no
預設設定: nt acl support = yes
If this option, and lanman auth are both disabled, then only NTLMv2 logins will be permited. Not all clients support NTLMv2, and most will require special configuration to us it.
Default : ntlm auth = yes
預設設定: nt pipe support = yes
You should not need to ever disable this 選項。
預設設定: nt status support = yes
參見smbpasswd(5).
預設設定: null passwords = no
預設設定: obey pam restrictions = no
要注意的是上面的說法也表明了samba並不會從服務名而推演出相應的使用者名稱.這樣的話對於[homes]段就比較麻煩了.要避免麻煩的話需要用user = %S,這句就表明你的使用者列表user正好就是這個服務資源名,這時的主目錄名就是使用者名稱.
參見 user 選項。
預設設定: only user = no
除非你理解了samba的oplock程式碼,否則不要改變這個選項!
預設設定: oplock break wait time = 0
簡單地說,這個選項指定了一個數字,如果爭奪相同檔案的使用者數量超過了此設定極限的話,即使有請求,smbd(8)也不再認可oplock的操作了.這樣的話smbd就象Windows NT一樣的執行.
除非你理解了samba的oplock程式碼,否則不要改變這個選項!
預設設定: oplock contention limit = 2
oplocks會有選擇性地關閉每一個基本共享資源上的特定檔案.參見 veto oplock files 選項.在有些系統上會透過最底層的作業系統確認oplocks.這樣就可以在所有的訪問與oplocked檔案中進行資料同步,而不管此訪問是透過samba或NFS或者是本地的UNIX程序.參見kernel oplocks選項檢視細節.
參見 kernel oplocks 以及 level2 oplocks parameters.
預設設定: oplocks = yes
<nt driver name> = <os2 driver name>.<device name>
For example, a valid entry using the HP LaserJet 5 printer driver would appear as HP LaserJet 5L = LASERJET.HP LaserJet 5L.
The need for the file is due to the printer driver namespace problem described in ???. For more details on OS/2 clients, please refer to ???.
預設設定: os2 driver map = <空字串>
注意: 預設情況下,Samba將在本地主控瀏覽器選舉中超越所有M$作業系統並且獲勝,除非還有Windows NT4.0/2000 域控制器。這意味著Samba主機的錯誤配置將使一個子網的瀏覽無效。參見Samba docs/ 目錄中的BROWSING.txt 來獲取詳細資訊。
預設設定: os level = 20
示例: os level = 65
預設設定: pam password change = no
預設設定: panic action = <空字串>
示例: panic action = "/bin/sleep 90000"
Disabling this option prevents Samba from making this check, which involves deliberatly attempting a bad logon to the remote server.
預設設定: paranoid server security = yes
This parameter is in two parts, the backend's name, and a 'location' string that has meaning only to that particular backed. These are separated by a : character.
Available backends can include: .TP 3 • smbpasswd - The default smbpasswd backend. Takes a path to the smbpasswd file as an optional argument. .TP • tdbsam - The TDB based password storage backend. Takes a path to the TDB as an optional argument (defaults to passdb.tdb in the private dir directory. .TP • ldapsam - The LDAP based passdb backend. Takes an LDAP URL as an optional argument (defaults to ldap://localhost) LDAP connections should be secured where possible. This may be done using either Start-TLS (see ldap ssl) or by specifying ldaps:// in the URL argument. .TP • nisplussam - The NIS+ based passdb backend. Takes name NIS domain as an optional argument. Only works with sun NIS+ servers. .TP • mysql - The MySQL based passdb backend. Takes an identifier as argument. Read the Samba HOWTO Collection for configuration details. .LP
預設設定: passdb backend = smbpasswd
示例: passdb backend = tdbsam:/etc/samba/private/passdb.tdb smbpasswd:/etc/samba/smbpasswd
示例: passdb backend = ldapsam:ldaps://ldap.example.com
示例: passdb backend = mysql:my_plugin_args tdbsam
這個chat序列一般發生在特定的主機上,取決於本地口令控制的方法(就象NIS或者別的).
注意這個選項僅僅在unix password sync選項設定為yes的時候有用。當smbpasswd檔案中的SMB口令被更改時是以root身份執行的,不必輸入舊密碼文字. 這意味著root必須可以在不知道使用者密碼時重置他的密碼。在NIS/YP 中這意味著passwd程式必須在NIS主控伺服器上執行。
這個字串可以包含%n宏,用於替換新密碼。chat序列還可以包含標準宏\\n, \\r, \\t 和\\s 來給出換行,回車,tab和空格。chat序列字串還可以包含'*' 來匹配任何字元序列。雙引號用來將帶空格的字串設為一個單獨的字串。
如果在對話序列的任何部分發送的字串為一個句號".",那麼不會發送任何內容.同樣,如果等待接收部分有字串是一個".",那麼不等待任何的內容.
如果pam password change引數設定為yes,chat可以以任何順序進行,沒有特定的輸出,是否成功可以由PAM結果得到。在PAM會話中宏\n被忽略。
參見 unix password sync, passwd program , passwd chat debug 和 pam password change.
預設設定: passwd chat = *new*password* %n\n *new*password* %n\n *changed*
示例: passwd chat = "*Enter OLD password*" %o\n "*Enter NEW password*" %n\n "*Reenter NEW password*" %n\n "*Password changed*"
參見 passwd chat , pam password change , passwd program .
預設設定: passwd chat debug = no
需要注意的是很多口令程式強調口令要合法,例如應該有最小長度或者是字母與數字的混合.這可能在一些客戶端(如WfWg)總將口令轉為大寫傳送時,引起一些問題.
注意如果把unix password sync選項設為yes的話,在改變smbpasswd檔案中的SMB口令時是以root身份呼叫改口令程式的.如果口令更改失敗的話,smbd對SMB口令的更改也會失敗,這是設計時的機制.
如果設定了unix password sync選項的話,指定口令程式時必須使用所有程式的絕對路徑,必須檢查安全問題.預設的unix password sync選項值是 no.
參見 unix password sync.
預設設定: passwd program = /bin/passwd
示例: passwd program = /sbin/npasswd %u
此選項定義了口令字中大寫字母的最大數量.
例如,假定給出的口令是"FRED".如果 password level設為1的話,在"FRED"驗證失敗時會嘗試以下的口令組合:
"Fred", "fred", "fRed", "frEd","freD"
如果password level設為2的話,就會嘗試下面的組合:
"FRed", "FrEd", "FreD", "fREd", "fReD", "frED", ..
等等。
把此選項設成的值越高,相對單一大小寫口令來說大小寫混合的口令越容易匹配。.不過,要小心使用這個選項會降低安全性,同時增加處理新聯接所花的時間量.
如果把選項設為0時會使處理口令時只作兩種嘗試 - 先與給出的口令比較,再比較它的全部小寫形式.
預設設定: password level = 0
示例: password level = 4
此選項設定上面所說的其它口令伺服器的名字或者IP地址. 新的語法允許在連線到ADS realm伺服器時指定埠號。要指定預設的LDAP 389埠之外的號碼,可以將埠號放在名字或ip後面,中間用一個冒號連線(比如說,192.168.1.100:389)。如果你不指定一個埠,Samba將使用標準的LDAP埠tcp/389. 注意埠號在WindowsNT4.0 域或者netbios連線的伺服器上無效
如果引數是一個名稱,它將使用 name resolve order 中指定的方式來解析。
口令伺服器應該是使用"LM1.2X002"或"LM NT 0.12"協議的主機,而且它本身必須使用使用者級安全模式.
注意:使用口令伺服器表明你的UNIX主機(就是執行Samba的那臺)就只與你指定的口令伺服器具有相同的安全等級了.在沒有完全信任的情況下不要選擇使用其它的口令伺服器.
不要把口令服務指向Samba伺服器本身,這產生一個迴圈而去查詢你的Samba伺服器,導致死鎖.
在指定口令伺服器名時可以使用標準的替換符,而實際能用的可能只是%m這一個,這個替換符說明Samba伺服器會用聯入的客戶作為口令伺服器.如果這樣用的話說明你非常信任你的客戶,同時最好以主機允許策略對他們進行限制!
如果把安全級security選項設為domain或者ads的話,指定的其它口令伺服器必須是在這個Domain中的一個主域控制器或備份域控制器或者'*'.另外指定字元'*'的話就以samba伺服器會在整個域中使用加密驗證RPC呼叫來驗證使用者登入.使用 security = domain的好處是,如果指定了幾個password server時,smbd 會對每一個進行嘗試直到它收到回應,對於初始伺服器當機時這就很有用了.
如果password server選項設為字元'*'的話,samba將嘗試透過查詢WORKGROUP<1C>名字來自動查詢主或者備份域控制器並聯系經過名字解析得到的IP地址列表中的每個伺服器來進行使用者驗證.
如果伺服器列表包含名字或IP同時也包含'*'時,列表將視為首選域控制器的列表,但是也會新增一個自動的對所有其餘DC的查詢。Samba不會透過定位最近的DC來最佳化這張列表。
如果security是server的話,會有一些安全級為security = domain時所沒有的限制:
如果在password server選項中指定了幾個口令伺服器的話,smbd在聯接具體的伺服器時會失敗,也不能驗證任何的使用者賬號.這是安全級為security = server 模式時SMB/CIFS協議的一個限制,並且Samba無法修改.
如果把Windows NT伺服器作為口令伺服器,你必須確保使用者可以從Samba伺服器上進行登入.當使用 security = server模式時,網路登入看起來是從那裡處理的,而不是從使用者工作站.
參見 security 選項。
預設設定: password server = <空字串>
示例: password server = NT-PDC, NT-BDC1, NT-BDC2, *
示例: password server = windc.mydomain.com:389 192.168.1.101 *
示例: password server = *
對於那些要對訪客提供的可列印服務來說,服務項應該設為只讀,而且路徑應該設為全域性可寫屬性並具有粘性(s)位.這當然不是強制性的,不過不這樣做的話可能會無法得到你所希望的結果.
路徑出現%u的地方將以正處於聯接狀態的UNIX使用者名稱來替換;同樣出現%m的地方將以請求聯接的主機NetBIOS名替換.在設定偽主目錄時,這種替換項很有用的.
所指定的路徑都是基於根目錄root dir(如果有的話)的.
預設設定: 無
示例: path = /home/fred
預設設定: pid directory = ${prefix}/var/locks
示例: pid directory = /var/run/
預設設定: posix locking = yes
一個有趣的示例,用於解除安裝伺服器資源:
postexec = /etc/umount /cdrom
參見 preexec.
預設設定: 無 (不執行命令)
示例: postexec = echo
一個有趣的示例,在使用者每一次登入時向對方傳送一個歡迎資訊:(一條格言?)
preexec = csh -c 'echo
當然,一段時間以後這類資訊可能就比較討厭了:-)
參見 preexec close 和 postexec .
預設設定: 無 (不執行命令)
示例: preexec = echo
預設設定: preexec close = no
如果設此選項為yes時,nmbd會在啟動時強制進行一次選舉,它有一些有利條件來贏得選舉.推薦把此選項與 domain master = yes聯合使用,這樣nmbd可以保證成為一個域瀏覽器.
小心使用此項,因為如果在相同的子網內有多個主機(不管是Samba伺服器,Windows95還是NT)參加選舉的話,他們每個都會週期性不斷地嘗試成為本地主瀏覽器,這時會造成不必須的廣播交通流量並降低瀏覽效能.
參見 os level.
預設設定: preferred master = auto
注意,如果你想載入printcap裡所有的印表機,那麼用load printers會更容易.
預設設定: no preloaded services
示例: preload = fred lp colorlp
預設設定: preload modules =
示例: preload modules = /usr/lib/samba/passdb/mysql.so+++
預設設定: preserve case = yes
參見NAME MANGLING段中的完整討論.
注意一個可列印的服務總是允許透過快取列印資料的方法向服務項路徑中執行寫操作(需要使用者有可寫許可權).read only選項控制只允許不可列印地訪問資源.
預設設定: printable = no
To use the CUPS printing interface set printcap name = cups . This should be supplemented by an addtional setting printing = cups in the [global] section. printcap name = cups will use the "dummy" printcap created by CUPS, as specified in your CUPS configuration file.
在可以用lpstat命令列出可用印表機的列表的System V系統上,可以用printcap name = lpstat 來自動獲得可用印表機列表.這對於配置samba時定義成SYSV的系統(這就包括了很多基於System V的系統)來說是預設情況.如果在這些系統上設好printcap name為lpstat的話,samba就會執行lpstat -v並嘗試分析輸出資訊以獲得一份印表機列表.
通常最小的printcap檔案看起來就象下面這樣:
print1|My Printer 1 print2|My Printer 2 print3|My Printer 3 print4|My Printer 4 print5|My Printer 5
我們看到'|'符號用來定義印表機的別名.第二個帶有空格的別名其實是提示Samba它是註釋.
在AIX中預設的printcap檔名是/etc/qconfig. 如果在檔名中找到qconfig字樣,Samba將假定檔案是AIX 的qconfig格式。
預設設定: printcap name = /etc/printcap
示例: printcap name = /etc/myprintcap
列印命令是一個簡單的文字字串。它可以在宏替換之後逐字傳遞給系統。
%s, %f - 緩衝檔名路徑
%p - 適當的印表機名
%J - 客戶提交的作業名
%c - 緩衝的作業需要列印的頁數
%z -緩衝的列印作業的大小(以位元組計)
列印命令至少必須包含%s或%f替換符中的一個,而%p是個可選項.在提交列印作業時,如果不提供印表機名的話,%p替換符會從列印命令中刪掉.
如果在[global]段中指定了列印命令,它將被用於任何可列印性的服務項,而不再需要在它們之中單獨指定了.
如果既沒有對可列印性服務項單獨指定列印命令又沒有指定一個全域性的列印命令時,假離線檔案雖然會建立卻不會被處理也不會被刪除(這很重要哦).
注意在某些UNIX上以nobody賬號身份進行列印會導致失敗.如果發生了這樣的情況請建立一個單獨的有列印權的訪客賬號並在[global]段裡設定guest account選項.
如果你明白命令是直接傳遞給shell的話,你可以組織非常複雜的列印命令.舉例來說,下面的命令會記錄一個列印作業,列印這個檔案然後刪掉它.注意這裡的';'是shell指令碼命令常用的分隔符.
print command = echo Printing %s >> /tmp/print.log; lpr -P %p %s; rm %s
你可能必須根據平時在系統上列印檔案的方式來改變這個命令.預設情況下,此選項會根據printing選項的設定而變化.
預設設定: 對於 printing = BSD, AIX, QNX, LPRNG 或者 PLP :
print command = lpr -r -P%p %s
對於 printing = SYSV 或者 HPUX :
print command = lp -c -d%p %s; rm %s
對於 printing = SOFTQ :
print command = lp -d%p -s %s; rm %s
對於 printing = CUPS :
如果Samba 編譯時加入了libcups, 那麼printcap=cups將使用CUPS API來提交作業等等。否則它用-oraw選項,使用SystemV命令來列印,也就是說它會用lp -c -d%p -o raw; rm %s.當printing = cups, 並且Samba編譯時加入了libcups時,任何手工設定的列印命令將被忽略。
示例: print command = /usr/local/samba/bin/myprintscript %p %s
預設設定: printer admin = <空字串>
示例: printer admin = admin, @staff
如果在[global]段裡指定了印表機名稱,那麼給出的印表機就用於任何可列印性服務項而不需個別的指定印表機名稱了.
預設設定: 空 (在很多系統中可能是 lp )
示例: printer name = laserwriter
通常系統支援九種印表機風格,它們是BSD, AIX, LPRNG, PLP, SYSV, HPUX, QNX, SOFTQ,還有 CUPS
要在系統上檢視使用了不同的選項後其它列印命令的預設值,可以用testparm(1)程式.
此項可以在每一臺印表機上分別設定.
參見[printers]段的討論。
Default :private dir = ${prefix}/private
When not in domain mode with winbindd then the security info copied onto the local workstation has no meaning to the logged in user (SID) on that workstation so the profile storing fails. Adding this parameter onto a share used for profile storage changes two things about the returned Windows ACL. Firstly it changes the owner and group owner of all reported files and directories to be BUILTIN\\Administrators, BUILTIN\\Users respectively (SIDs S-1-5-32-544, S-1-5-32-545). Secondly it adds an ACE entry of "Full Control" to the SID BUILTIN\\Users to every returned ACL. This will allow any Windows 2000 or XP workstation user to access the profile.
Note that if you have multiple users logging on to a workstation then in order to prevent them from being able to access each others profiles you must remove the "Bypass traverse checking" advanced user right. This will prevent access to other users profile directories as the top level profile directory (named after the user) is created by the workstation profile code and has an ACL restricting entry to the directory tree to the owning user.
預設設定: profile acls = no
此命令應該是個只用印表機名作為選項的程式或指令碼,以便用來停止列印佇列,使列印作業不再向列印機發送.
此命令不支援Windows for Workgroups,但可以在Windows 95和NT的印表機視窗中傳送.
此處用替換符%p可以替代印表機名稱.否則這個名稱將被放置在命令後面.
注意,在命令中使用絕對路徑是個好習慣,因為不一定可以獲得伺服器的PATH變數.
預設設定: 依賴於 printing 選項的設定
示例: queuepause command = disable %p
此命令應該是個只用印表機名作為選項的程式或指令碼,以便用來恢復列印佇列,使列印作業繼續向列印機發送.
此命令不支援Windows for Workgroups,但可以在Windows 95和NT的印表機視窗中傳送.
此處用替換符%p可以替代印表機名稱.否則這個名稱將被放置在命令後面.
注意,在命令中使用絕對路徑是個好習慣,因為不一定可以獲得伺服器的PATH變數.
預設設定: 依賴於 printing 選項的設定
示例: queuepause command = enable %p
預設設定: read bmpx = no
參見 write list 和 invalid users 選項。
預設設定: read list = <空字串>
示例: read list = mary, @students
如果這個引數是yes, 那麼服務的使用者不能建立或修改服務目錄中的檔案。
注意一個可列印的服務(printable = yes) 的目錄 總是 可寫的(需要使用者可寫許可權)但是隻能透過緩衝操作來寫.
預設設定: read only = yes
如果允許,那麼它會以65535 位元組為單位來讀取一個數據包的65535位元組.這會帶來較多的效能方面的好處.
但是,有些客戶端使用不正確的包容量(雖然是可允許的),或者它們不支援大容量包,所以對這些客戶端你應該禁止這一選項.
通常將此選項作為一種系統除錯工具,而且嚴格來說不應修改.參見write raw選項.
預設設定: read raw = yes
在磁碟與網路的訪問速度相近時,這種交迭式的工作就會做得非常好,不過當其中一類裝置的速度大大高於另一類時,它只會有那麼一點點效果.
預設的值是16384,但沒有做過測試最優值的實驗。根據已經瞭解的情況來看,在使用不同的系統時,最最佳化值的差別很大.一個大於65536的值是沒有任何意義的,它只會造成不必要的記憶體分配.
預設設定: read size = 16384
示例: read size = 8192
預設設定: realm =
示例: realm = mysambabox.mycompany.com
如果你要samba伺服器處在一個通常瀏覽傳播規則沒有正常工作的遠端工作組裡時,用此項就很有用了.此遠端工作組可以位於IP包到得到的任何地方.
例如:
remote announce = 192.168.2.255/SERVERS 192.168.4.255/STAFF
以上這行說明nmbd 對兩個給出的使用工作組名的IP地址進行申明.如果你只用了IP地址的話,那麼會用workgroup選項裡給出的工作組名來替代.
你選用的IP地址通常應該是遠端網路的廣播地址,不過也可以用配置穩定的網路中的已知主瀏覽器IP地址.
預設設定: remote announce = <空字串>
This is useful if you want your Samba server and all local clients to appear in a remote workgroup for which the normal browse propagation rules don't work. The remote workgroup can be anywhere that you can send IP packets to.
例如:
remote browse sync = 192.168.2.255 192.168.4.255
以上行會使nmbd向位於指定子網或地址中的主瀏覽器請求同步他們本地伺服器中的瀏覽列表
你選用的IP地址通常應該是遠端網路的廣播地址,不過也可以用配置非常穩定的網路中的已知主瀏覽器IP地址.如果給出一個主機的IP地址,或者主控瀏覽器事實上在自己的網段中, samba就不驗證遠端主機是否有效、是否正在偵聽了。
預設設定: remote browse sync = <空字串>
The security advantage of using restrict anonymous = 1 is dubious, as user and group list information can be obtained using other means.
The security advantage of using restrict anonymous = 2 is removed by setting guest ok = yes on any share.
預設設定: restrict anonymous = 0
加入一個root directory,注意不是實際的"/"目錄,可以增加額外的安全級別,但是代價就高了.這樣完全確保了所指定的root directory及所屬子目錄外的檔案都是不能訪問的,包括伺服器正常執行時所需的一些檔案也是如此.因此要想維護伺服器整體的可操作性,你需要映象一些系統檔案到所指定的root directory下.特別是要映象 /etc/passwd檔案或此檔案的子集,如果需要的話,任何列印操作要用到的二進位制檔案或配置檔案也要映象.當然,應該由作業系統決定必須被映象的檔案集合.
預設設定: root directory = /
示例: root directory = /homes/smb
參見 postexec.
預設設定: root postexec = <空字串>
參見 preexec 和 preexec close 選項.
預設設定: root preexec = <空字串>
參見 preexec 和preexec close.
預設設定: root preexec close = no
這個選項設定了“安全模式位”用於答覆協議協商以使smbd(8) 調整共享安全級是開或者關.客戶端根據此位決定是否(以及如何)向伺服器傳送使用者和口令資訊.
預設值是security = user,這也是在Windows 98和Windows NT環境中最常用的設定.
可選的值 security = share, security = server 或者security = domain .
2.0.0版本之前的Samba中,預設值是
security = share
主要因為當時只有這一個值可選。
在WfWg裡有一個錯誤,當在使用使用者和伺服器安全級時,WfWg客戶將會完全忽略你在"connect drive"對話方塊裡鍵入的口令.這就使除了在WfWg裡已登入的使用者以外的任何人要聯接Samba服務項變得非常困難.
如果你的主機使用與UNIX主機上相同的使用者名稱時,就應當使用security = user.如果你用的使用者名稱通常在UNIX上不存在時就應該用security = share.
如果你想設定共享而不用口令的話(訪客級共享)也應該用security=share.這通常用於提供共享列印的伺服器.在security=user裡設定guest帳戶非常困難,詳細的情況請參見map to guest選項.
smbd可能會使用一種混雜模式(hybrid),這樣就可以在不同的NetBIOS aliases下提供使用者和共享級的安全特性.
現在解釋各個不同的設定.
SECURITY = SHARE
當客戶聯接到一個共享安全級的伺服器,在聯接共享資源之前無需用一個合法的使用者名稱和口令登入到伺服器(雖然現在的客戶端象WIN95/95及NT在與security = share 的伺服器交談時都會以使用者名稱傳送一個登入請求,但卻沒有帶口令).相反,客戶端會在每一個共享上傳送認證資訊(口令)以嘗試聯接到這個共享項.
注意 smbd 總是 用合法的UNIX使用者代表客戶進行操作, 即使是在 security = share 的時候.
因為在共享安全級中,客戶無需向伺服器傳送使用者名稱,所以smbd用一些技術來為客戶決定正確的UNIX使用者賬號.
用於匹配給出客戶口令的可能的UNIX使用者名稱列表可以用以下方法建立:
如果設定了guest only選項,則跳過所有其它步驟只檢查guest account使用者名稱.
如果透過共享連線請求傳送一個使用者名稱,則此使用者名稱(對映後 - 參見username map)被作為潛在使用者名稱加入.
如果客戶使用一個先前的 logon 請求(SessionSetup SMB呼叫)則在SMB中傳送的使用者名稱將作為潛在使用者名稱加入.
客戶請求的服務項名被作為潛在使用者名稱加入.
客戶的NetBIOS名被作為潛在使用者名稱加入到列表中.
在user列表中的任何使用者都被作為潛在使用者名稱加入.
如果未設guest only選項,則使用提供的口令來嘗試此列表.對於匹配到口令的第一個使用者將作為UNIX使用者身份使用.
如果設定了guest only選項或未檢測到使用者名稱,則如果共享項中標誌為可以使用guest account,那麼使用此訪客使用者賬號,否則拒絕訪問.
注意,在共享安全級中關於哪個UNIX使用者名稱最後將在允許訪問中使用非常混淆.
參見NOTE ABOUT USERNAME/PASSWORD VALIDATION段.
SECURITY = USER 這是samba2.0/3.0預設安全級設定.對於使用者安全級,一個客戶必須先以合法的使用者名稱和口令(也可以用username map選項程序對映)“登入”.在此安全模式中也可使用加密口令(參見encrypted passwords選項).如果設定瞭如user和guest only這樣的選項,則它們會被應用並且在此連線上更改UNIX使用者賬號,但只能在使用者賬號被成功驗證之後才行.
注意,當伺服器成功驗證客戶身份之前,請求的資源名稱是不傳送到伺服器上的.這就是為什麼使用者安全級中在沒有允許伺服器自動把未知使用者對映為guest account的情況下,訪客共享無法工作.參見map to guest選項獲得完成對映的細節.
參見NOTE ABOUT USERNAME/PASSWORD VALIDATION段.
SECURITY = DOMAIN
只有已經用 net(8)把伺服器新增進一個Windows NT的域中,此安全模式才能正常工作.它要求encrypted passwords選項設為yes.在此模式中Samba將試圖把使用者名稱/口令傳送到一個WindowsNT主域或備份域控制器進行驗證像一臺真正的WindowsNT伺服器那樣。
注意,仍然需要存在一個和域控制器上的使用者名稱一致的有效的UNIX使用者,來使Samba擁有一個有效的UNIX帳戶來對映存取檔案操作。
注意,對於客戶端來說,security=domain模式與security=user是一樣的.它隻影響 伺服器處理驗證工作的方式.對於客戶端無任何影響.
注意,當伺服器成功驗證客戶身份之前,請求的資源名稱是不傳送到伺服器上的.這就是為什麼域安全級中在沒有允許伺服器自動把未知使用者對映為guest account的情況下,訪客共享無法工作.參見map to guest選項獲得完成對映的細節
參見 NOTE ABOUT USERNAME/PASSWORD VALIDATION 段.
參見 password server parameter 和 encrypted passwords 選項。
SECURITY = SERVER
在此模式中Samba將試圖把使用者名稱/口令傳送到其它SMB伺服器,比如一臺NT伺服器,進行驗證.如果驗證失敗則回到security = user模式,它需要encrypted passwords 引數設定為yes,除非遠端系統不支援它們。但是要注意,如果使用了加密口令的話,samba不會再去檢查UNIX系統口令檔案的,它必須有一個合法的smbpasswd檔案以再次檢查使用者賬號.參見Samba HOWTO Collection 中關於User Database 的章節來獲得如何設定的資訊。
This mode of operation has significant pitfalls, due to the fact that is activly initiates a man-in-the-middle attack on the remote SMB server. In particular, this mode of operation can cause significant resource consuption on the PDC, as it must maintain an active connection for the duration of the user's session. Furthermore, if this connection is lost, there is no way to reestablish it, and futher authenticaions to the Samba server may fail. (From a single client, till it disconnects).
注意,對於客戶端來說,security=server模式與security=user是一樣的.它隻影響伺服器處理驗證工作的方式.對於客戶端無任何影響.
注意,當伺服器成功驗證客戶身份之前,請求的資源名稱是不傳送到伺服器上的.這就是為什麼伺服器安全級中在沒有允許伺服器自動把未知使用者對映為guest account的情況下,訪客共享無法工作.參見 map to guest選項獲得完成對映的細節.
參見 NOTE ABOUT USERNAME/PASSWORD VALIDATION 段.
參見 password server parameter 和 encrypted passwords 選項。
SECURITY = ADS
In this mode, Samba will act as a domain member in an ADS realm. To operate in this mode, the machine running Samba will need to have Kerberos installed and configured and Samba will need to be joined to the ADS realm using the net utility.
Note that this mode does NOT make Samba operate as a Active Directory Domain Controller.
Read the chapter about Domain Membership in the HOWTO for details.
參見 ads server parameter, the realm paramter 和encrypted passwords 選項。
預設設定: security = USER
示例: security = DOMAIN
此選項用掩碼值'與'實現對許可權位的更改,從而防止修改未出現在此掩碼中的任何位.可以將掩碼中的0看作使用者無權更改的位值. This parameter is applied as a mask (AND'ed with) to the changed permission bits, thus preventing any bits not in this mask from being modified. Essentially, zero bits in this mask may be treated as a set of bits the user is not allowed to change.
如未明確設定此選項,則把此選項設為0777,允許使用者修改檔案的所有user/group/world這些許可權.
注意,可透過其它手段訪問到Samba伺服器的使用者可以輕而易舉地繞過此限制,所以此選項只對獨立的伺服器系統有用.多數普通系統的管理員可以將它保留為0777.
參見 force directory security mode, directory security mask, force security mode 選項.
預設設定: security mask = 0777
示例: security mask = 0770
Please note that with this set to no you will have to apply the WindowsXP requireSignOrSeal-Registry patch found in the docs/Registry subdirectory.
預設設定: server schannel = auto
示例: server schannel = yes
When set to auto, SMB signing is offered, but not enforced. When set to mandatory, SMB signing is required and if set to disabled, SMB signing is not offered either.
預設設定: client signing = False
它還設定顯示在瀏覽列表中主機名後的內容.
%v 將替換為Samba版本號
%h 將替換為主機名
預設設定: server string = Samba %v
示例: server string = University of GNUs Samba Server
setdir命令只在Digital Pathworks客戶端中實現.參見Pathworks文件的細節.
預設設定: set directory = no
預設設定: No default value
示例: set primary group script = /usr/sbin/usermod -g '%g' '%u'
This parameter should specify the path to a script that can set quota for the specified arguments.
The specified script should take the following arguments:
1 - quota type .TP 3 • 1 - user quotas .TP • 2 - user default quotas (uid = -1) .TP • 3 - group quotas .TP • 4 - group default quotas (gid = -1) .LP
2 - id (uid for user, gid for group, -1 if N/A)
3 - quota state (0 = disable, 1 = enable, 2 = enable and enforce)
4 - block softlimit
5 - block hardlimit
6 - inode softlimit
7 - inode hardlimit
8(optional) - block size, defaults to 1024
The script should output at least one line of data.
參見 get quota command 選項。
預設設定: set quota command =
示例: set quota command = /usr/local/sbin/set_quota
這些開啟模式UNIX是不直接支援的,所以要用共享記憶體或在UNIX不支援共享記憶體時(一般都支援)用鎖定檔案來模擬.
允許共享模式的選項是DENY_DOS, DENY_ALL, DENY_READ,DENY_WRITE, DENY_NONE 和DENY_FCB.
預設情況下此選項提供了完全的共享相容和許可.
你 不應 把此選項關閉因為很多Windows應用會因此停止執行。
預設設定: share modes = yes
參見 NAME MANGLING 段.
預設設定: short preserve case = yes
Under normal circumstances, the Windows NT/2000 client will open a handle on the printer server with OpenPrinterEx() asking for Administrator privileges. If the user does not have administrative access on the print server (i.e is not root or a member of the printer admin group), the OpenPrinterEx() call fails and the client makes another open call with a request for a lower privilege level. This should succeed, however the APW icon will not be displayed.
Disabling the show add printer wizard parameter will always cause the OpenPrinterEx() on the server to fail. Thus the APW icon will never be displayed. Note :This does not prevent the same user from having administrative privilege on an individual printer.
參見 addprinter command, deleteprinter command, printer admin
Default :show add printer wizard = yes
This command will be run as the user connected to the server.
%m %t %r %f parameters are expanded:
%m will be substituted with the shutdown message sent to the server.
%t will be substituted with the number of seconds to wait before effectively starting the shutdown procedure.
%r will be substituted with the switch -r. It means reboot after shutdown for NT.
%f will be substituted with the switch -f. It means force the shutdown even if applications do not respond for NT.
預設設定: None.
示例: shutdown script = /usr/local/samba/sbin/shutdown %m %t %r %f
Shutdown script example:
#!/bin/bash $time=0 let "time/60" let "time++" /sbin/shutdown $3 $4 +$time $1 &
Shutdown does not return so we need to launch it in background.
參見 abort shutdown script.
預設設定: smb passwd file = ${prefix}/private/smbpasswd
示例: smb passwd file = /etc/samba/smbpasswd
預設設定: smb ports = 445 139
By default Samba will accept connections on any address.
示例: socket address = 192.168.2.20
套接字選項是使用在允許調整連線的作業系統的網路層的控制命令.
此選項通常用於在區域網上最佳化調整samba伺服器的效能.因為samba無法知道與你的網路所對應的最佳化選項,所以你必須自己進行試驗並作出選擇.我們強烈推薦你先閱讀與你的作業系統有關的相應檔案(也許man setsockopt會有幫助).
你可能會發現在有些系統上samba會在你使用一個選項時發出"Unknown socket option"的資訊.這就說明你沒有正確拼寫或者需要為作業系統新增一個包含檔案到includes.h中.如有後面指出的問題請寫信到samba-bugs@samba.org.
只要作業系統允許,你可以以任何方法組合任何所支援的套接字選項.
當前可用於此選項的可設定套接字選項列表有:
SO_KEEPALIVE
SO_REUSEADDR
SO_BROADCAST
TCP_NODELAY
IPTOS_LOWDELAY
IPTOS_THROUGHPUT
SO_SNDBUF *
SO_RCVBUF *
SO_SNDLOWAT *
SO_RCVLOWAT *
標有'*'的要使用一個整數引數.其它的有時使用1或0代表允許或禁止該選項,如未指定1或0則預設值都為允許.
要指定一個變數,用"SOME_OPTION=VALUE"格式。比如可以是SO_SNDBUF=8192.注意,在"="前後不能有任何空格.
如在區域網上,則使用下面這個是比較明智的:
socket options = IPTOS_LOWDELAY
如有一個區域網則可以試一下:
socket options = IPTOS_LOWDELAY TCP_NODELAY
如有一個廣域網,則試一下IPTOS_THROUGHPU.
注意有些選項可導致samba伺服器完全失效.小心使用它們!
預設設定: socket options = TCP_NODELAY
示例: socket options = IPTOS_LOWDELAY
If the value of this parameter starts with a "|" character then Samba will treat that value as a pipe command to open and will set the environment variables from the output of the pipe.
The contents of the file or the output of the pipe should be formatted as the output of the standard Unix env(1) command. This is of the form:
Example environment entry:
SAMBA_NETBIOS_NAME = myhostname
預設設定: No default value
Examples: source environment = |/etc/smb.conf.sh
示例: source environment = /usr/local/smb_env_vars
預設設定: stat cache = yes
When strict allocate is no the server does sparse disk block allocation when a file is extended.
Setting this to yes can help Samba return out of quota messages on systems that are restricting the disk quota of users.
預設設定: strict allocate = no
當禁用strict locking時,伺服器只在客戶明確要求時才為他們檢查檔案鎖.
循規蹈矩的客戶總是在重要的時候要求檢查檔案鎖,所以在多數情況下strict locking = no是可取的.
預設設定: strict locking = no
參見 sync always 選項。
預設設定: strict sync = no
參見 strict sync 選項。
預設設定: sync always = no
此選項設定了對syslog傳送資訊的閾值.只有小於此值的除錯級資訊號才發給syslog.
預設設定: syslog = 1
預設設定: syslog only = no
預設設定: template homedir = /home/%D/%U
預設設定: template primary group = nobody
預設設定: template shell = /bin/false
預設設定: time offset = 0
示例: time offset = 60
預設設定: time server = no
預設設定: unicode = yes
預設設定: unix charset = UTF8
示例: unix charset = ASCII
預設設定: unix extensions = yes
參見 passwd program, passwd chat.
預設設定: unix password sync = no
為了讓此選項正確工作,當它設為yes時必須把 encrypt passwords選項設為no .
注意即使設定了此選項,smbd還是必須驗證使用者賬號,直到輸入合法的口令後才能正確連線並更新他們的雜湊計算(由smbpasswd完成)後的口令字.
預設設定: update encrypted = no
The differentiating factor is that under normal circumstances, the NT/2000 client will attempt to open the network printer using MS-RPC. The problem is that because the client considers the printer to be local, it will attempt to issue the OpenPrinterEx() call requesting access rights associated with the logged on user. If the user possesses local administator rights but not root privilegde on the Samba host (often the case), the OpenPrinterEx() call will fail. The result is that the client will now display an "Access Denied; Unable to connect" message in the printer queue window (even though jobs may successfully be printed).
If this parameter is enabled for a printer, then any attempt to open the printer with the PRINTER_ACCESS_ADMINISTER right is mapped to PRINTER_ACCESS_USE instead. Thus allowing the OpenPrinterEx() call to succeed. This parameter MUST not be able enabled on a print share which has valid print driver installed on the Samba server.
參見 disable spoolss
預設設定: use client driver = no
預設設定: use mmap = yes
只有當主機無法提供它自己的使用者名稱時才需要username選項。當用COREPLUS 協議或你的使用者擁有與UNIX使用者名稱不同的WfWg使用者名稱時就會有這樣的情況.在這兩種 情況下,用\\server\share%user語句代替會更好的.
在大多數情況下username選項並不是最好的解決方案,因為它意味著Samba會 嘗試對username選項行中的每個使用者名稱輪流作測試.這樣做是很慢的,而且萬 一很多使用者重複口令的話這就是個壞主意了.錯誤使用此選項可能會帶來超時或安全 缺陷.
samba依靠底層的UNIX安全.此選項不限制登入者,它只對Samba伺服器提供響應所提 供口令的使用者名稱的線索.任何喜歡的人都可以登入,而且如果他們只是啟動一次 telnet對話的話不會造成破壞.程序以登入的使用者身份執行,所以他們無法做任何他 們不能做的事兒.
要對一組特殊的使用者限制一個服務的話可以用 valid users 選項.
如果任何使用者名稱以'@'字元開始則此使用者名稱將首先在NIS網路組列表(如果Samba編譯 時加入了網路組支援的話)中進行查詢,然後在UNIX使用者組資料庫中查詢並展開成屬 於以此名為組的所有使用者的列表.
如果任何使用者名稱以'+'字元開始則此使用者名稱只在UNIX使用者組資料庫中進行查詢並展開成屬於以此名為組的所有使用者的列表.
如果任何使用者名稱以'&'字元開始則此使用者名稱只在NIS網路組列表(如果Samba編譯時加入了網路組支援的話)中進行查詢並展開成屬於以此名為組的所有使用者的列表.
注意透過使用者組資料庫進行查詢要花很長時間,在此期間有些客戶可能會超時.
檢視 NOTE ABOUT USERNAME/PASSWORD VALIDATION 段來獲得這個選項如何決定訪問服務方面的資訊。
預設設定: 如果是guest服務就是guest帳號,否則是空字串.
示例:username = fred, mary, jack, jane, @users, @pcgroup
如果把此選項設為非0,則情況就改變了.此選項指定的是用於嘗試同時檢測UNIX使用者名稱的大寫字母的組合數.數字越高,則嘗試的組合數越多,但使用者名稱的發現也越慢.當在你的UNIX主機上有奇特的使用者名稱如AstrangeUser 時使用此選項.
預設設定: username level = 0
示例: username level = 5
對映檔案被逐行解析.每個行都應該在'='號左邊包含一個UNIX使用者名稱,而在右邊跟上一列使用者名稱.右邊的使用者名稱列表可以包含@group形式的名稱,它表示匹配任何組中的UNIX使用者名稱.特殊客戶名'*'是一個萬用字元用於匹配任何名稱.對映檔案的每個行可以達到1023個字元的長度.
對檔案的處理是在每個行上取得提供的使用者名稱並把它與'='號右邊的每個使用者名稱進行比較.如果提供的名稱匹配右邊的任何名稱則用左邊的名稱替換右邊的.然後繼續處理下一行.
忽略以'#' 或 ';'號開始的行.
當在行中發現了匹配,則在以'!'開始的行後中止處理,否則繼續處理每一行的對映.當你在檔案中用了通配對映的話'!'就很有用了.
例如把名稱admin 或 administrator對映為UNIX名 root,你可以這樣:
root = admin administrator
或把UNIX組 system中的任何人對映為UNIX名sys就可以這樣:
sys = @system
可以在一個使用者名稱對映檔案中包含很多對映關係.
如果你的系統支援NIS NETGROUP選項,則在使用/etc/group 匹配組之前先檢查網路組資料庫.
你可以透過在名稱上使用雙引號來對映含有空格的Windows使用者名稱.例如:
tridge = "Andrew Tridgell"
將把windows使用者名稱"Andrew Tridgell"對映為unix使用者名稱"tridge".
以下示例將把mary和fred對映為unix使用者sys,然後把其餘的對映為guest.注意使用'!'符號可以告訴Samba如果在該行獲得一個匹配的話就停止處理.
!sys = mary fred guest = *
注意重對映作用於所有出現使用者名稱的地方.因此如果你連線到\\server\fred而 fred已被重對映為 mary,則你實際會連線到\\server\mary"並需要提供mary的口令而不是 fred的.這種情況只有一個例外,那就是使用者名稱是被傳到 password server(如果你有一個的話)驗證的.口令伺服器會接收客戶提供的未經修改的使用者名稱.
同時要注意反向對映是不會出現的.這主要影響的是列印任務.已經被對映的使用者會在刪除列印任務時遇到麻煩,因為WfWg上的列印管理器會認為他們不是列印任務的屬主.
預設設定: no username map
示例: username map = /usr/local/samba/lib/users.map
預設設定: use sendfile = no
預設設定: use spnego = yes
Due to the requirements of the utmp record, we are required to create a unique identifier for the incoming user. Enabling this option creates an n^2 algorithm to find this number. This may impede performance on large installations.
參見 utmp directory 選項。
預設設定: utmp = no
預設設定: no utmp directory
示例: utmp directory = /var/run/utmp
This option should not be used by regular users but might be of help to developers. Samba uses this option internally to mark shares as deleted.
預設設定: True
如果此項為空(預設)則任何使用者都可以登入.如果一個使用者名稱同時存在於此列表及invalid users列表,則拒絕此使用者訪問.
%S 替換為當前服務名. 這在[homes]段裡非常有用.
參見 invalid users
預設設定: 空 (任何人都不會被拒絕)
示例: valid users = greg, @pcusers
每項必須是一個UNIX路徑,而非一個DOS路徑,同時必須不含 UNIX目錄分隔符'/'.
注意case sensitive選項適用於對檔案的禁止目的.
需要明白這個選項的很重要的一個特點: 在Samba刪除一個目錄時的行為。如果一個目錄除了veto files之外不包含任何內容,刪除操作將失敗,除非設定了delete veto files 是yes.
設定此選項會影響Samba的效能,因為它將強制在掃描所有檔案和目錄時檢查是否匹配.
參見 hide files 和 case sensitive.
預設設定: 沒有隱藏任何檔案.
示例:
; 隱藏任何檔名帶有'Security'的檔案, ; 任何副檔名是.tmp的檔案,任何檔名帶有'root'的檔案 veto files = /*Security*/*.tmp/*root*/ ; 隱藏NetAtalk伺服器建立的Apple專用的檔案 veto files = /.AppleDouble/.bin/.AppleDesktop/Network Trash Folder/
預設設定: 沒有隱藏oplocks許可
你可能想在已知客戶會猛烈爭奪的檔案上使用此項.在NetBench SMB基準程式下面就是個好例子,它導致客戶猛烈地對以.SEM字尾的檔案進行連線.為使Samba不在這些檔案上允許oplocks,你可以在[global]段或特定的NetBench共享中使用此行:
示例: veto oplock files = /*.SEM/
預設設定: no value
示例: vfs objects = extd_audit recycle
預設設定: 共享的名稱
注意設定此選項可對伺服器效能產生負面影響,因為samba必須做一些額外的系統呼叫以檢查那些連結.
預設設定: wide links = yes
預設設定: winbind cache type = 300
預設設定: winbind enable local accounts = yes
Warning: Turning off group enumeration may cause some programs to behave oddly.
預設設定: winbind enum groups = yes
Warning: Turning off user enumeration may cause some programs to behave oddly. For example, the finger program relies on having access to the full user list when searching for matching usernames.
預設設定: winbind enum users = yes
The winbind gid parameter specifies the range of group ids that are allocated by the winbindd(8) daemon. This range of group ids should have no existing local or NIS groups within it as strange conflicts can occur otherwise.
預設設定: winbind gid = <空字串>
示例: winbind gid = 10000-20000
Please note that setting this parameter to + causes problems with group membership at least on glibc systems, as the character + is used as a special character for NIS in /etc/group.
預設設定: winbind separator = '´
示例: winbind separator = +
預設設定: winbind trusted domains only = <no>
The winbind gid parameter specifies the range of user ids that are allocated by the winbindd(8) daemon. This range of ids should have no existing local or NIS users within it as strange conflicts can occur otherwise.
預設設定: winbind uid = <空字串>
示例: winbind uid = 10000-20000
預設設定: winbind use default domain = <no>
示例: winbind use default domain = yes
此選項以如下形式指定要呼叫的一個指令碼名或可執行程式:
wins_hook operation name nametype ttl IP_list
第一部分引數是opration(運算子),它有三種:"add"、"delete"和"refresh".在很多情況下該運算子可以忽略,因為其它選項可提供足夠的資訊.注意當有名稱以前沒有加入過,則有時會用到"refresh",在這種情況下,它應該和"add"有同樣含義.
第二部分引數是netbios名.如果該名稱不是合法名的話,該功能就不執行.合法的名稱應只包含字母,數字,減號,下劃線和句點.
第三部分引數是用2位十六進位制數字表示的netbios名稱型別.
第四部分引數是以秒計算的名稱有效時間TTL (time to live).
第五部分是當前該名稱所註冊的IP地址表.如果表為空則該名稱被刪除.
一個呼叫BIND動態DNS更新程式nsupdate的指令碼示例在samba原始碼的示例目錄可以找到.
預設設定: wins partners =
示例: wins partners = 192.168.0.1 172.16.1.2
預設設定: wins proxy = no
如果你有多個子網的話,應該指定向你的WINS伺服器
If you want to work in multiple namespaces, you can give every wins server a 'tag'. For each tag, only one (working) server will be queried for a name. The tag should be seperated from the ip address by a colon.
注意,如有多子網並希望跨子網瀏覽工作正常的話,應該設定Samba指向一臺WINS伺服器.
預設設定: 未啟用
示例: wins server = mary:192.9.200.1 fred:192.168.3.199 mary:192.168.2.61
For this example when querying a certain name, 192.19.200.1 will be asked first and if that doesn't respond 192.168.2.61 . If either of those doesn't know the name 192.168.3.199 will be queried.
示例: wins server = 192.9.200.1 192.168.2.61
預設設定: wins support = no
預設設定: 編譯時設定為 WORKGROUP
示例: workgroup = MYGROUP
This cache allows Samba to batch client writes into a more efficient write size for RAID disks (i.e. writes may be tuned to be the RAID stripe size) and can improve performance on systems where the disk subsystem is a bottleneck but there is free memory for userspace programs.
The integer parameter specifies the size of this cache (per oplocked file) in bytes.
預設設定: write cache size = 0
示例: write cache size = 262144
for a 256k cache size per file.
注意如果一個使用者同時屬於讀列表和寫列表則擁有寫入權.
參見 read list 選項。
預設設定: write list = <空字串>
示例: write list = admin, root, @staff
預設設定: write raw = yes
參見 utmp 選項。 By default this is not set, meaning the system will use whatever utmp file the native system is set to use (usually /var/run/wtmp on Linux).
預設設定: no wtmp directory
示例: wtmp directory = /var/log/wtmp
雖然配置檔案允許服務項名包含空格,但你的客戶端軟體就不一定了.因為在比較中總是忽略空格,所以這不成問題 - 但應該認識到其它可能性.
有一條類似提示,很多客戶特別是DOS客戶,會限制服務項名為8個字元.雖然 smbd(8)沒有這樣的限制,但如果這樣的客戶截去部分服務項名的話,他們的連線嘗試會失敗.為此你可能要保持你的服務項名在8個字元以內.
對於管理員來說[homes] 和 [printers]特殊段的使用很容易,但對預設屬性的多樣組合應該小心.當設計這些段時要特別仔細.特別是要確保假離線目錄許可權的正確性.
此手冊頁是針對samba套件版本3.0的。
samba(7), smbpasswd(8), swat(8), smbd(8), nmbd(8), smbclient(1), nmblookup(1), testparm(1), testprns(1).
samba軟體和相關工具最初由Andrew Tridgell建立。samba現在由Samba Team 作為開源軟體來發展,類似linux核心的開發方式。
最初的samba手冊頁是 Karl Auer寫的。 手冊頁原始碼已經轉換為YODL格式(另一種很好的開源軟體,可以在ftp://ftp.ice.rug.nl/pub/unix找到),由Jeremy Sllison 更新到Samba2.0 版本。 Gerald Carter 在Samba2.2中將它轉化為DocBook 格式。 Alexander Bokovoy 在Samba 3.0中實現了DocBook XML4.2 格式的轉換。
meaculpa <meaculpa@21cn.com>
2000/12/08
http://cmpp.linuxforum.net
跋
本頁面中文版由中文
man 手冊頁計劃提供。
中文 man
手冊頁計劃:https://github.com/man-pages-zh/manpages-zh