Sambaの設定

このサイトを参考にやったら簡単にできた。
http://solaris-user.com/solaris10/samba_swat.html

以下、本文を引用

Solaris10でsambaとswatの設定をするには
ここでは、Windowsとファイル共有などで連携するために samba の設定方法を紹介する。
samba自体は Solaris 9 でもバンドルされているし、フリーウェアなのでどこからでも入手できるが、せっかくなので Solaris 10 にバンドルされているもので設定してみる。

プログラム本体は/usr/sfw/sbin 以下にある smbd だ。

bash-3.00# cd /usr/sfw/sbin
bash-3.00# ls
bgpdstart nmbd ripdstop smbd tcpd zebraadm
bgpdstop ospfdstart safe_finger snmpd tcpdchk
mysqld ospfdstop ser snmptrapd tcpdmatch
mysqld_safe ripdstart serctl swat try-from

Solaris 10 3/05 版のデフォルトのバージョンは 3.0.4 だが、パッチ 119757-01 を適用することで 3.0.11 になる。

bash-3.00# ./smbd -V
Version 3.0.11

■ smb.conf ファイルの作成

テンプレートは /etc/sfw/smb.conf-example なのでこれをコピーして使用する。

bash-3.00# cd /etc/sfw
bash-3.00# ls
a2ps-site.cfg mysql ser
a2ps.cfg openssl smb.conf-example
foomatic private zebra
bash-3.00# cp smb.conf-example smb.conf

ほとんどデフォルトのままだが、PCの環境などにworkgroupなどを合わせるなどの変更を加えた。(太字の部分が変更点)

bash-3.00# cat smb.conf
#======================= Global Settings========================
[global]

workgroup = WORKGROUP
server string = Samba Server
security = user
hosts allow = 192.168.1. 127.
load printers = no
; printcap name = /etc/printcap
; printcap name = lpstat
; printing = cups
; guest account = pcguest
log file = /var/samba/log.%m
max log size = 50
; password server =
; realm = MY_REALM
; passdb backend = tdbsam
; include = /usr/sfw/lib/smb.conf.%m
socket options = TCP_NODELAY
; interfaces = 192.168.12.2/24 192.168.13.2/24
; local master = no
; os level = 33
; domain master = yes
; preferred master = yes
; domain logons = yes
; logon script = %m.bat
; logon script = %U.bat
; logon path = \\%L\Profiles\%U
; wins support = yes
; wins server = w.x.y.z
; wins proxy = yes
dns proxy = no
; add user script = /usr/sbin/useradd %u
; add group script = /usr/sbin/groupadd %g
; add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null
-s /bin/false %u
; delete user script = /usr/sbin/userdel %u
; delete user from group script = /usr/sbin/deluser %u %g
; delete group script = /usr/sbin/groupdel %g


#============================ Share Definitions ====================
[homes]
comment = Home Directories
browseable = no
writable = yes
path = /export/home/%S

; [netlogon]
; comment = Network Logon Service
; path = /usr/sfw/lib/netlogon
; guest ok = yes
; writable = no
; share modes = no

;[Profiles]
; path = /usr/local/samba/profiles
; browseable = no
; guest ok = yes

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
# Set public = yes to allow user 'guest account' to print
guest ok = no
writable = no
printable = yes

# This one is useful for people to share files
;[tmp]
; comment = Temporary file space
; path = /tmp
; read only = no
; public = yes

;[public]
; comment = Public Stuff
; path = /home/samba
; public = yes
; writable = yes
; printable = no
; write list = @staff

;[fredsprn]
; comment = Fred's Printer
; valid users = fred
; path = /homes/fred
; printer = freds_printer
; public = no
; writable = no
; printable = yes

;[fredsdir]
; comment = Fred's Service
; path = /usr/somewhere/private
; valid users = fred
; public = no
; writable = yes
; printable = no

;[pchome]
; comment = PC Directories
; path = /usr/pc/%m
; public = no
; writable = yes

[public]
path = /export/public
public = yes
only guest = yes
writable = yes
printable = no

[myshare]
comment = for user1
path = /export/shared
valid users = user1
public = no
writable = yes
printable = no
create mask = 0765
bash-3.00#

これでとりあえず samba を起動してみる。

bash-3.00# /etc/init.d/samba start

smbd と nmbd が動作していれば正常だ。
/etc/rc3.d/S90samba があるので再起動時も smb.conf の記述に誤りがなければ自動的に起動する。

また、アクセスするために以下のようにユーザー user1 を登録する。
( user1 はあらかじめシステムのユーザーとして /etc/passwd ファイルに登録されている必要がある)

bash-3.00# /usr/sfw/bin/smbpasswd -a user1
New SMB password:パスワード入力

Retype new SMB password:再度パスワード入力

Added user user1