2010年8月11日 星期三

SAMBA作File Server

參考文章
1. SAMBA smbpasswd 與 passwd 的同步設定
http://www.pigo.idv.tw/archives/6
2. Chapter 18 - Samba (非常完整)
http://www.brennan.id.au/18-Samba.html


SAMBA 安全模式


1. security = user       (使用SAMBA本身的帳號作驗證
2. security = domain 
3. security = ADS
4. security = server
5. security = share     (不作驗證,大家可以直接存取

使用的驗證協定
1.NTLM          (一般使用)
   (缺點,在網路上可以看到使用者帳號名稱,只有密碼加密)
2.Kerberos    (只要有微軟AD就一定是用這項)
   (帳號密碼全部保護)

使用的傳輸協定
1.NetBIOS(TCP139)
     (較老舊的系統使用的協定)
2.SMB(TCP445)
    (比較新的系統使用的協定)


預設SAMBA不使用/etc/passwd下的使用者帳號
所以在這裡我們要將兩項結合起來

#安裝libpam-smbpass套件
$sudo apt-get install libpam-smbpass

手動建立Samba 的使用者帳號
$sudo smbpasswd -a $USER

共享使用者家目錄
修改/etc/samba/smb.conf 加入以下命令
其他原有基本設定請參考
SAMBA作Master Browser
========================
[global]
workgroup = it100
wins support = yes
netbios name = it100MB
os level = 255

domain master = no 
preferred master = yes
local master = yes

browse list = yes
dns proxy = no
security = user 
guest only = no
guest ok = no

name resolve order = wins lmhosts bcast

log file = /var/log/samba/log.%m
max log size = 1000
syslog = 2

[homes]
  comment = Home Directories

  # browseable = no 這設定, 使得在網芳系統不會看到 homes 這名稱
  browseable = no

  # By default, the home directories are exported read-only. Change next
  # parameter to ‘yes’ if you want to be able to write to them.
  writable = yes

  # By default, \\server\username shares can be connected to by anyone
  # with access to the samba server. Un-comment the following parameter
  # to make sure that only “username” can connect to \\server\username
  valid users = %S

  # 符合指定格式的檔案(.*), 會自動被附於 '隱藏' 屬性
  hide files = /.*/    
           
  create mode = 0664
  directory mode = 0775
========================

之後重新啟動samba

sudo /etc/init.d/samba restart

就可以在windows或linux連接到網路磁碟機
windows測試
連線網路磁碟機
\\192.168.100.5\username
輸入帳號跟密碼連到ubuntu該使用者的家目錄

沒有留言:

張貼留言