2013-04-13

samba4.0分享設定中的share已經不行用了

samba4.0已經不能設定security = share了,如果一樣要用匿名分享,只要修改以下幾行就行了。

sudo vim /etc/samba/smb.conf

[global]
security = user
map to guest = Bad User
guest ok = Yes
guest account = XXX

最後一個guest account不一定要設功能是以匿名登入後使其認為是你所指定的ID連入,只要本機的資料是你那個所指定的ID所建立的,都可以直接刪除,不用設定writable = yes囉。之前幾版好像就有對我來講還蠻好用的所以補上它。

設定完成要重開smbd nmbd才會生效哦

sudo systemctl restart smbd nmbd

以下是我的完整設定可以參考參考。有需要看自已的請用指令:
testparm

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[電影]"
Processing section "[連續劇]"
Processing section "[歌仔戲]"
Processing section "[tmp]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions


[global]
workgroup = MSHOME
server string = Samba Server
map to guest = Bad User
guest account = hepha
log file = /var/log/samba/log.%m
max log size = 50
printcap name = /etc/printcap
dns proxy = No
wins support = Yes
idmap config * : backend = tdb
guest ok = Yes

[homes]
comment = Home Directories
read only = No
browseable = No

[printers]
comment = All Printers
path = /var/spool/samba
guest ok = No
printable = Yes
print ok = Yes
browseable = No

[電影]
path = /mnt/big
read only = No
create mask = 0664
directory mask = 0775
想要了解更多4.0版的請看另外4.0版也可以當不過我用不到沒研究。

另外我在Jamyy's的部落格看到以下兩個設定或許對其它也有用。
Fedora 9 升級 Samba Server
徹底取消印表機功能

load printers = no
printcap name = /dev/null
disable spoolss = yes
;cups options = raw

samba 3.5 以上, 允許家目錄內的 soft link

wide links = yes
unix extensions = no

參考資料: