設定 Samba Server
- 編輯設定檔:/usr/local/etc/smb.conf
[global]
workgroup = sport # 與Win95/98之網路設定值相同。
server string = %N (%h) is Samba %v Server.
load printers = no
log file = /var/log/log.%m
security = user
encrypt passwords = yes
socket options = TCP_NODELAY
dns proxy = no
config file = /usr/local/etc/smb.conf
client code page = 950
netbios name = DN221 #
從網路上的芳鄰所欲顯示的電腦主機名稱
update encrypted = yes
hide dot files = yes
[homes] # 每一位user的根目錄設定項目
comment = Home Directories
browseable = no
writeable = yes
public = no
[doc] # 公用文件檔目錄
browseable = yes
comment = 公用文件檔案區
create mask = 0777 # 此目錄的權限
path = /samba/doc
public = yes
guest ok = yes
read only = yes # 限制此目錄區之一般user是唯讀的權限。
write list = @wheel # 當此user屬於wheel組群者,則可以寫入。
- 建立Samba的使用者密碼檔
smbpasswd -a [username] [password]
smbpasswd -h 可得知詳細的說明。
- 設定啟動環境
chmod 755 /var/spool/lock
編輯/etc/services檔
將netbios字串開頭的六行設定註解起來
建立開機啟動的script檔
cd /usr/local/etc/rc.d
cp samba.sh.sample samba.sh
chmod 751 samba.sh
修改samba.sh
將這兩行
$smbd -D
$nmbd -D
改為
$smbd -D -d1
$nmbd -D -d1 -n dn221
其中,$nmbd -D -d1 -n dn221之dn221參數(是Samba Server 的名字),要與smb.conf中之netbios
name設定相同。Win95/98的網路上的芳鄰就可看見Samba主機(dn221)。
- 啟動Samba Server
/usr/local/etc/rc.d/samba.sh start
- 測試Samba Server
testparm
或者是
testparm > temp.txt
將結果輸出至文字檔,慢慢研究。
- 在FreeBSD上執行
smbclient -L dn221
當詢問password時,此刻是以root身份執行smbclient程式,所以按Enter鍵即可。
假設,FreeBSD上有一user之帳號為tim,必須依步驟4建立其Samba
Server上之密碼資料,再執行
smbclient -L dn221 -U tim
Password:輸入tim的密碼,以下的結果表示tim可以從Win95/98連線至Samba
Server了:
Domain=[SPORT] OS=[Unix] Server=[Samba 2.0.6]
Sharename Type Comment
--------- ---- -------
document Disk 公用文件檔案區(Read Only)
html Disk 公用文件檔案區(Read Only)
IPC$ IPC IPC Service (dn221 (dn221) is Samba 2.0.6
Server.)
admin Disk Home Directories
Server Comment
--------- -------
DN221 dn221 (dn221) is Samba 2.0.6 Server.
SPORTEX
Workgroup Master
--------- -------
SPORT SPORTEX
而這樣的結果是錯誤的:
session setup failed: ERRSRV - ERRbadpw (Bad password - name/password pair
in a Tree Connect or Session Setup are invalid.)
- 在Win95/98之工作平台重新以建好之帳號與密碼登入,打開
網路上的芳鄰後,就可以看到 Samba Server
主機所分享出來的所有資料了。
回到上一頁