Next Previous Contents

5. 一般組態設定 (/etc/smb.conf)

在 linux (或其他 UNIX機器)上的 Samba 組態設定是被單一檔案, /etc/smb.conf ,所控制. 這個檔決定你想要哪個系統資源分享給外面世界以及你想對他們做什麼限制.

因為以下章節將會處理分享 linux 磁碟與印表機給 Windows 機器, 本小節所展示的 smb.conf 檔儘量是你所能取得較簡單的, 它只是以介紹性為目的.

目前還不要擔心細節部分. 後面的章節將會介紹主要的概念.

在檔案中的每的段落{section}會有個段落標頭開始, 其標頭像是 [global], [homes], [printers] 等等.

[global] 段落定義一些變數, 而 Samba 將用來定義於所有資源之分享.

[homes] 段落允許遠端使用者來存取在當地(linux)機器上之他們的(且只有他們的) home directories{家目錄}. 也就是, 如果一個 Windows 使用者從他們的 Windows 機器要設法連接到這個分享, 他們將是連接到他們自己個人的 home directiory. 要做這樣事情,所要注意的是,他們必須在linux box上有個帳號.

以下的 smb.conf 檔案樣本允許遠端使用者來用當地機器上他們的 home directories 而且寫到一個暫存的目錄. 對一個 Windows 使用者,要想看到這些分享, linux box 必須是在區域網路{local network}內. 然後,使用者簡單地從 Windows File Manager 或 Windows Explorer 連接到網路磁碟.

在以下段落要注意的是, 對這個檔之額外項目將會用來允許更多資源被分享.


; /etc/smb.conf
;
; Make sure and restart the server after making changes to this file, ex:
; /etc/rc.d/init.d/smb stop
; /etc/rc.d/init.d/smb start

[global]
; Uncomment this if you want a guest account
; guest account = nobody
   log file = /var/log/samba-log.%m
   lock directory = /var/lock/samba
   share modes = yes

[homes]
   comment = Home Directories
   browseable = no
   read only = no
   create mode = 0750

[tmp]
   comment = Temporary file space
   path = /tmp
   read only = no
   public = yes


Next Previous Contents