samba server / smb.conf 設定例

samba serverの設定がややこしいので分かりやすくまとめてみた。
設定のポリシーは下記のとおりです。

・ /etc/samba/smbpasswd でパスワード管理する
・ /mnt のデータをsambaとして公開する

/etc/samba/smb.conf

[global]

        workgroup = workgroup
        netbios name = samba server
        server string = samba server
        os level = 20
        writeable = yes
        public = yes
        security = user
        encrypt passwords = yes
        passdb backend = smbpasswd

[samba]
        path = /mnt
        comment = samba directory

smbpasswdの作成方法は

smbpasswd -a username

と分かりやすいです。smbpasswdのhelpの内容は下記のとおり。

smbpasswd: invalid option -- -
When run by root:
    smbpasswd [options] [username]
otherwise:
    smbpasswd [options]

options:
  -L                   local mode (must be first option)
  -h                   print this usage message
  -s                   use stdin for password prompt
  -c smb.conf file     Use the given path to the smb.conf file
  -D LEVEL             debug level
  -r MACHINE           remote machine
  -U USER              remote username
extra options when run by root or in local mode:
  -a                   add user
  -d                   disable user
  -e                   enable user
  -i                   interdomain trust account
  -m                   machine trust account
  -n                   set no password
  -W                   use stdin ldap admin password
  -w PASSWORD          ldap admin password
  -x                   delete user
  -R ORDER             name resolve order