LIVA-X samba 4

samba

 # yum -y install samba 

sambaの設定

# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.

[global]
        workgroup = WORKGROUP
        security = user

        passdb backend = tdbsam

        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw

[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes
        inherit permissions = Yes
        create mask=0700
        directory mask=0700

[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = root
        create mask = 0664
        directory mask = 0775

[media]
        comment = DLNA Meida Contents
        path = /home/samba/media
        read only = yes
        create mask = 0777
        directory mask = 0777
        write list = user1

[share]
        comment = Public Folder
        path = /home/samba/share
        read only = no
        inherit permissions = yes
        force create mode = 0660
        create mask = 0770
        directory mask = 0770
        valid users = @homeusers
        write list = user1, user2
        force group = homeusers
127.0.0.1 localhost 

SELinuxのコンテキストラベル

共有フォルダー

drwxr-xr-x. user1 homeusers unconfined_u:object_r:samba_share_t:s0 media
drwxr-x---. user1 homeusers unconfined_u:object_r:samba_share_t:s0 share

ホームディレクトリ

# setsebool -P samba_enable_home_dirs 1
# getsebool samba_enable_home_dirs
samba_enable_home_dirs --> on

sambaプロセス

system_u:system_r:nmbd_t:s0     /usr/sbin/nmbd
system_u:system_r:smbd_t:s0     /usr/sbin/smbd

sambaサービスの設定

sambaサービスの自動起動

# systemctl enable smb.service

# systemctl enable nmb.service 

sambaサービスの起動

# systemctl start nmb

# systemctl start smb 

ディストリビューション

CentOS 7.x