2011年4月24日 星期日

如何在 Linux 架設 Samba 網路芳鄰分享檔案

Linux : Ubuntu、Ubuntu Server

Windows : Windows 7

 

1.安裝Samba

# sudo apt-get install samba

 

2.備份smb.conf

# cp /etc/samba/smb.conf /etc/samba/smb.conf-bak

 

3.新增使用者(有兩種)

使用舊的版本

# smbpasswd –a user

完成後密碼檔在/etc/samba/smbpasswd

smbpasswd –h 可以查看更多參數

使用新的版本

# pdbedit –a user

完成後可用pdbedit –L 看目前使用者

pdbedit –x 刪除使用者

 

4.編輯smb.conf

# vim /etc/samba/smb.conf

 

1 [global]

2 workgroup = BohanSamba

3 netbios name = BohanPC

4 security = user

5

6 [share]

7 path = /home/download/

8 valid users = download

9 read only = no

10 browseable = yes

11 create mask = 0755
12 directory mask = 0755

 

5.重新啟動samba(有兩種)

使用舊的版本

# /etc/init.d/samba restart

使用新的版本

# sudo service smbd restart

# sudo service nmbd restart

 

6. 輸入IP 帳號 密碼

\\ yourip

windows7samba

7.刪除連線

開啟命令提示字元輸入

net use * /delete