FreeBSD 12.1-RESEASE に samba 4.8 をインストールしました。FreeBSD のホームディレクトリに Windows や Mac から接続するための最低限の設定を行いました。
ports は最新の状態にしておきます。
# cd /usr/ports/net/samba48
# make install clean
途中オプションを選択する画面が出ますがそのままOKとしておきました。
なぜか /usr/local/etc/smb4.conf が作られていなかったので、ゼロから作りました。自分のディレクトリだけに入る設定です。
local master = no としておかないと、警告が出ます。平たく言うと他のsambaサーバーとバッティングするらしいのです。エラーではないので動作はしますがサーバー側に変なメッセージが出続けます。
[global] workgroup = ネットワークで使用されている名前 server string = 適当に netbios name = 適当に dns proxy = no local master = no os level = 200 unix charset = UTF-8 dos charset = CP932 hosts allow = 127.0.0.1, 192.168.0. security = user map to guest = Bad User load printers = no log file = /var/log/samba4/log.%m guest ok = no [share] comment = Shared Directories path = /home/share browseable = yes writable = yes [user] path = /usr/home/user comment = Volume for user read only = no guest ok = no create mask = 0700 directory mask = 0700
ユーザーの登録は以下のように行います。
すでに FreeBSD 側に一般ユーザーとして登録してある場合,ユーザー USERNAME を登録するには
# pdbedit -a -u USERNAME
new password: <- 入力する
retype new password: <- 再入力する
起動・終了・再起動は以下のようにします。
# service samba_server start
# service samba_server stop
# service samba_server restart
FreeBSDの起動とともに Samba を動かす場合は /etc/rc.conf に以下を付け加えておきます。
samba_server_enable="YES"
Windows であれば「ネットワーク」をダブルクリックします。Mac では Finderのメニュー -> 移動 -> サーバーへ接続... -> ブラウザをクリック。あとは現れたサーバーをダブルクリックしてユーザー名とパスワードを入力します。