2010年12月5日 星期日

OpenSUSE 11.3 Samba 設定

Open SUSE 11.3 的 Samba 版本為 3.5.4,安裝完成後必須先做一些檢查,確定 Samba 已正確安裝且可正常服務,它的設定檔位置為 /etc/samba/smb.conf

檢查 Samba 的版本可內以下指令
#smbd -V
Version 3.5.4-4.1-2382-SUSE-SL11.3
檢查 smb.conf 內的語法狀態可用以下指令
#testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[profiles]"
Processing section "[users]"
Processing section "[groups]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_DOMAIN_MEMBER
Press enter to see a dump of your service definitions
檢查 samba 使用的埠口
#netstat -apn | egrep ':137|:138|:139|:445'
tcp  0 0 :::445             :::*       LISTEN  2726/smbd
tcp  0 0 :::139             :::*       LISTEN  2726/smbd
udp  0 0 192.168.1.255:137  0.0.0.0:*          7646/nmbd
udp  0 0 192.168.1.13:137   0.0.0.0:*          7646/nmbd
udp  0 0 0.0.0.0:137        0.0.0.0:*          7646/nmbd
udp  0 0 192.168.1.255:138  0.0.0.0:*          7646/nmbd
udp  0 0 192.168.1.13:138   0.0.0.0:*          7646/nmbd
udp  0 0 0.0.0.0:138        0.0.0.0:*          7646/nmbd
檢查 nmbd 及 smbd 這二支服務是否存在
#ps aux | grep mbd
root      2726  0.0  0.6  19728  3076 ?        Ss   13:22   0:00 /usr/sbin/smbd -D -s /etc/samba/smb.conf
root      2732  0.0  0.2  19620  1076 ?        S    13:22   0:00 /usr/sbin/smbd -D -s /etc/samba/smb.conf
root      7646  0.0  0.3  10840  1672 ?        Ss   15:03   0:00 /usr/sbin/nmbd -D -s /etc/samba/smb.conf
root      7823 20.0  0.1   3696   772 pts/1    S+   15:50   0:00 grep mbd

以上的檢查如果都通過的話,就可以開始進行 smb.conf 檔的設定了

記得修改完 smb.conf 使用以下指令重新啟動 Samba
#rcsmb restart
#rcnmb restart
smb.conf 的內容如下:
# smb.conf is the main Samba configuration file. You find a full commented
# version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the
# samba-doc package is installed.
# Date: 2010-07-05

[global]
 #工作群組名稱
 workgroup = MSHOME
 
 #主機的 netbios 名稱,如果不設,預設為系統的主機名稱
 netbios name = OpenSUSE11 

 #顯示在網芳中的主機註解說明,可設可不設
 server string = Samba Server
 
 #用戶密碼資料庫,有三種選擇:smbpasswd,tdbsam,ldapsam
 #smbpasswd:使用 Samba 本身的工具 smbpasswd 管理用戶密碼
 #tdbsam:以 passdb.tdb 資料庫管理用戶密碼
 #ldapsam:以 LDAP 服務管理用戶密碼
 passdb backend = smbpasswd
   
 #將此 Samba Server 設定為 cups 印表機伺服器
 printing = cups
 printcap name = cups
 printcap cache time = 750
 cups options = raw
 
 #登入時錯誤的帳號會被對映到 guest 帳號,方便 windows 做匿名登入
 map to guest = Bad User
 
 include = /etc/samba/dhcp.conf
 
 logon path = \\%L\profiles\.msprofile
 logon home = \\%L\%U\.9xprofile
 logon drive = P:
 usershare allow guests = Yes
 add machine script = /usr/sbin/useradd  -c Machine -d /var/lib/nobody -s /bin/false %m$
 domain logons = No
 domain master = No
        
 #共有四種等級:user,server,domain,share
 #user:由 Samba 本身負責認證
 #server:由外部的 Samba server 進行認證
 #domain:由 NT 網域的控制站進行認證
 #share:完全不需要認證 
 security = user
 wins support = No
 usershare max shares = 100
[homes]
 comment = Home Directories
 valid users = %S, %D%w%S
 browseable = No
 read only = No
 inherit acls = Yes
[profiles]
 comment = Network Profiles Service
 path = %H
 read only = No
 store dos attributes = Yes
 create mask = 0600
 directory mask = 0700

[users]
 comment = All users
 path = /home
 read only = No
 inherit acls = Yes
 veto files = /aquota.user/groups/shares/
[groups]
 comment = All groups
 path = /home/groups
 read only = No
 inherit acls = Yes
[printers]
 comment = All Printers
 path = /var/tmp
 printable = Yes
 create mask = 0600
 browseable = No
[print$]
 comment = Printer Drivers
 path = /var/lib/samba/drivers
 write list = @ntadmin root
 force group = ntadmin
 create mask = 0664
 directory mask = 0775

## Share disabled by YaST
# [netlogon]

沒有留言:

張貼留言