はじめに
SMBなんて久しぶりすぎてちょっと不明なところが多かったので調べてみることにした。
ちなみに、FreeNAS11.2でインストールされているsmb4.confをもとに行っていきます。
ほぼ健忘録目的なのでこれから追記していきます。
ソースのconfig
[global]
server min protocol = SMB2_02
server max protocol = SMB3
interfaces = 127.0.0.1 1.2.3.4
bind interfaces only = yes
encrypt passwords = yes
dns proxy = no
strict locking = no
oplocks = yes
deadtime = 15
max log size = 51200
max open files = 2829962
logging = file
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
getwd cache = yes
guest account = nobody
map to guest = Bad User
obey pam restrictions = yes
ntlm auth = no
directory name cache size = 0
kernel change notify = no
panic action = /usr/local/libexec/samba/samba-backtrace
nsupdate command = /usr/local/bin/samba-nsupdate -g
server string = FreeNAS Server
ea support = yes
store dos attributes = yes
lm announce = yes
hostname lookups = yes
unix extensions = no
null passwords = yes
acl allow execute always = true
dos filemode = yes
multicast dns register = yes
domain logons = no
local master = yes
idmap config *: backend = tdb
idmap config *: range = 90000001-100000000
server role = standalone
netbios name = hogehoge
workgroup = WORKGROUP
security = user
create mask = 0777
directory mask = 0777
client ntlmv2 auth = yes
dos charset = CP932
unix charset = UTF-8
log level = 1
[AllShare]
path = "/mnt/Volume01/hogeShare"
printable = no
veto files = /.snapshot/.windows/.mac/.zfs/
writeable = yes
browseable = yes
access based share enum = no
vfs objects = zfs_space zfsacl streams_xattr
hide dot files = no
guest ok = yes
nfs4:mode = special
nfs4:acedup = merge
nfs4:chown = true
zfsacl:acesort = dontcare
config 項目について
server min/max protocol
ここ結構大事で、smbのプロトコル(サーバとクライアントがお話しする言葉)をどこまで使うかが記載される。
windowsの記事を見るとsmb1はなんとwindows10のデフォルトで落ちているとのこと。現在対応しているのが、SMBv2の2.02、2.1、3.0、3.02、3.11とのこと。
セキュリティ面からもwindows7とかが居ないなら、正直v2からでよいかと思います。
ここから、freeBSDのドキュメントから
server min protocol = SMB2_02
server max protocol = SMB3_11
と設定してあげるのがよいかと思います。(ただし、当たり前だがGUIの設定画面から設定を更新すると上書きされて消される)
printable
例えば文書とか、read権限つけてしまうと、読み込みだけなので印刷ができない!なんてことが起きます。
printable = yes
とすると、印刷が可能になるという優れものです。
これでspoolからの呼びかけに応じて印刷も可能になります。。
bind interfaces only
SMBがどのIPアドレスで応じるかを設定しているものです。
interfaces で設定します。
SMBのポートは137/138のいずれかになります。
strict locking
誰かファイルを使ってる時に、ほかの人が使えなくさせるための機能。
noだと明示的にクライアントから聞かれて初めて答える。
yesだと常にサーバ側が監視している状態になります。
autoだとoplock(使ってる時にローカルでキャッシュして使う仕組み)
このあとは随時加えてきます