Samba 讓 Linux 與 Windows 在區域網路無縫共享檔案,Linux 如同網路鄰居般可被存取,亦可掛載 Windows 磁碟如本地檔案。新手也能輕鬆上手。
若系統內建版本為 1.x,請先移除,從 官網 下載 2.0.x 版。已有 2.0 可跳過安裝。
/tmp:tar zxvf samba-xxxxxx.tgz -C /tmpcd /tmp/samba-xxxxx/src/./configure --enable-smbmount,否則直接 ./configuremakecp -a /tmp/samba-xxxx /usr/local → cd /usr/local/samba-xxxx/source && make install/usr/local/samba 建立二進制、設定、日誌目錄建立 /usr/local/samba/lib/smb.conf,最小測試設定:
[global] workgroup = workgroup [all] path = / read only = yes
關鍵:workgroup 必須與 Windows 網路工作組名稱一致。
/usr/local/samba/bin/nmbd -D /usr/local/samba/bin/smbd -D
Windows 登入既有 Linux 帳號密碼即可存取。
[global] workgroup = workgroup guest account = nobody keep alive = 30 os level = 2 security = user printing = bsd printcap name = /etc/printcap load printers = yes wins support = no ; wins server = 192.168.1.1 [local] path = /usr/local read only = yes [homes] comment = Home Directory browseable = no read only = no create mode = 0750 [cdrom] comment = Linux CD-ROM path = /cdrom read only = yes locking = no [printers] comment = All Printers browseable = no printable = yes public = no read only = yes create mode = 0700 directory = /tmp
ps x 找出 nmbd、smbd PIDkill PID 終止舊進程若 Windows 找不到 Linux 主機,請檢查 /usr/local/samba/var/log.smb 與 log.nmb。