iT邦幫忙

0

smaba 動態隱藏資料夾

sden 2012-08-22 10:24:365122 瀏覽

在我的device 有兩個wifi interface
eth0 : 192.168.0.1
eth1 : 192.168.1.1
我想要不同interface進來的人可以存取不同的資料夾,
ex:
eth0 --> folder2
eth1 --> folder1, folder2
但有個問題就是要隱藏不能存取的資料夾,
也就是說eth0 進來的人不能看到folder1...
但我不知道如何設定, 請大家幫忙~
samba server 必須要匿名登入..

smb.conf
#===== Global Settings =====
[global]
workgroup = MYGROUP
server string = Samba Server
security = share
load printers = no
log file = /var/log/samba/log.%m
max log size = 50
dns proxy = no
guest account = root
#===== Share Definitions =====
[folder1]
path = /media/card/
browseable = yes
writable = yes
guest ok = yes
read only = no
public = yes
hosts allow = 192.168.1.
hosts deny = ALL
[folder2]
path = /media/card/public
browseable = yes
writable = yes
guest ok = yes
read only = no
public = yes

sden iT邦新手 5 級 ‧ 2012-08-22 22:48:10 檢舉
如果不能隱藏的話, 有辦法使用eth0連上(192.168.0.x)連上的人要按folder1,會彈出錯誤視窗嗎? 因為目前這個設定都是彈出要輸入帳號密碼的視窗,怕會有人搞混..
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

4
James
iT邦大師 6 級 ‧ 2012-08-22 11:28:53
最佳解答

有一種做法——在smb.conf中include到不同的設定檔,
include = /etc/samba/smb-%i.conf
就可以分別在"smb-192.168.0.1.conf"和"smb-192.168.1.1.conf"設定不同的分享

小弟有簡單測試過並簡單紀錄下做法,如果合用可以再討論
http://beckjottings.blogspot.tw/2010/10/samba.html

看更多先前的回應...收起先前的回應...
sden iT邦新手 5 級 ‧ 2012-08-22 15:42:10 檢舉

這個方法我也有想過, 但好像會看到兩個server, 可以隱藏不需要看到的server嗎?

James iT邦大師 6 級 ‧ 2012-08-23 08:16:53 檢舉

如果你用IP去分設定檔,就不用設netbios aliases,就不會有多個SERVER NAME

sden iT邦新手 5 級 ‧ 2012-08-23 09:52:39 檢舉

像這樣嗎?? 可是我都看不到serverㄝ?
smb.conf
#===== Global Settings =====
[global]
workgroup = MYGROUP
server string = Samba Server
security = share
load printers = no
smb ports = 139 445
log file = /var/log/samba/log.%m
max log size = 50
dns proxy = no
guest account = root
bind interfaces only = True
interfaces = eth0 eth1
include = /etc/samba/smb-%i.conf

========smb-192.168.0.30=============
workgroup = groupA
netbios name = SDCARD
[sdcard]
comment = SDcard Share
path = /media/card/
read only = no
guest ok = Yes.conf

sden iT邦新手 5 級 ‧ 2012-08-23 10:10:51 檢舉

sorry, 好像是我的.conf file name 打錯了..我在看看有沒有其他問題。

James iT邦大師 6 級 ‧ 2012-08-23 11:56:13 檢舉

sden提到:
workgroup =
netbios name =

如果不想局分SERVER可以只在smb.conf設定

smb-192.168.0.30.conf 要加
interfaces = eth0 192.168.0.30

James iT邦大師 6 級 ‧ 2012-08-23 12:02:36 檢舉

後來看到你將 interfaces = eth0 eth1 設在smb.conf
這樣可能也可以,但是我覺得分開會比較清楚

sden iT邦新手 5 級 ‧ 2012-08-23 13:41:10 檢舉

感謝你的幫助~~

我要發表回答

立即登入回答