┏━━━━━━━━━━━━━━━━━━━
┃目的
┗━━━━━━━━━━━━━━━━━━━
既存のADに参加させたCentOS7にHDDを増設してAD権限で共有する。



┏━━━━━━━━━━━━━━━━━━━
┃前提
┗━━━━━━━━━━━━━━━━━━━
【デバイス】
/dev/sdb1

【マウント先】
/mnt/drive1

【Windows Server側の情報】
バージョン:不明
コンピュータ名:WINSERVER-NAME
ドメイン名:DM01
レルム:DM01.LOCAL
AD上の管理者:
 adadmin01
 adadmin02
AD上のユーザー:
 aduser01
 aduser02
 aduser03
AD上のグループ:
 adusers
 +aduser01
 +aduser02
 +aduser03
 grp01
 +aduser01
 grp02
 +aduser02
 grp03
 +aduser03
IPアドレス:192.168.10.6

【CentOS側の情報】
バージョン:CentOS7
コンピュータ名:CENTOS7-NAME
IPアドレス:192.168.10.231
マウント先:
/
+mnt/
|+drive1/ ← HDDのマウント
||+samba/ ← 上位フォルダ(非共有)
|||+adusers/ ← グループ全員で共有
|||+grp01-a/ ← グループ1が書込
|||+grp01-b/ ← グループ1が書込,グループ全員が参照
|||+grp02-a/ ← グループ2が書込
|||+grp02-b/ ← グループ2が書込,グループ全員が参照



┏━━━━━━━━━━━━━━━━━━━
┃手順
┗━━━━━━━━━━━━━━━━━━━

1.CentOS7をADに参加させる
http://ameblo.jp/dmmaf/entry-12073773371.html


2.CentOS7にUSB外付HDDを増設する(Ext4編)
http://ameblo.jp/dmmaf/entry-12094712148.html


3.共有設定を行う
3-1.ディレクトリ作成
3-1-1.ディレクトリ作成
# mkdir /mnt/drive1/samba/
# mkdir /mnt/drive1/samba/adusers/
# mkdir /mnt/drive1/samba/grp01-a/
# mkdir /mnt/drive1/samba/grp01-b/
# mkdir /mnt/drive1/samba/grp02-a/
# mkdir /mnt/drive1/samba/grp02-b/

3-1-2.ディレクトリ設定

権限変更
# chmod 770 /mnt/drive1/samba/adusers/
# chmod 775 /mnt/drive1/samba/grp01-a/
# chmod 770 /mnt/drive1/samba/grp01-b/
# chmod 775 /mnt/drive1/samba/grp02-a/
# chmod 770 /mnt/drive1/samba/grp02-b/

所有者変更
# chown root:adusers /mnt/drive1/samba/adusers/
# chown root:grp01 /mnt/drive1/samba/grp01-a/
# chown root:grp01 /mnt/drive1/samba/grp01-b/
# chown root:grp02 /mnt/drive1/samba/grp02-a/
# chown root:grp02 /mnt/drive1/samba/grp02-b/

# cd /mnt/drive1/samba/
# ls -l
drwxrwx--- 5 root adusers 4096 11月 12 11:52 /mnt/drive1/samba/adusers/
drwxrwx--- 5 root grp01 4096 11月 12 11:43 /mnt/drive1/samba/grp01-a/
drwxrwxr-x 6 root grp01 4096 11月 12 11:52 /mnt/drive1/samba/grp01-b/
drwxrwx--- 3 root grp02 4096 11月 12 11:52 /mnt/drive1/samba/grp02-a/
drwxrwxr-x 2 root grp02 4096 11月 12 11:22 /mnt/drive1/samba/grp02-b/


3-2./etc/samba/smb.confの書換

バックアップ
# cp /etc/samba/smb.conf /etc/samba/smb.conf.old

◆/etc/samba/smb.conf内の確認箇所([global])

workgroup = DM01
password server = WINSERVER-NAME
realm = DM01.LOCAL

authconfig-tuiコマンドで書き換わっているハズ。


◆/etc/samba/smb.conf内の変更箇所([global])
#--globalに追加--start-line--

    unix charset = UTF-8
    dos charset = CP932
    map to guest = Never
    unix password sync = yes
    hosts allow = 127. 192.168.

#--globalに追加--end-line--

◆/etc/samba/smb.conf内の変更箇所(最終行に追加)
[グループ全員で共有]
comment = グループ全員で共有
path = /mnt/drive1/samba/adusers/
public = yes
writable = yes
read only = no
printable = no
write list = @adusers
create mask = 0660
directory mask = 0770
;
[grp01専用]
comment = grp01専用
path = /mnt/drive1/samba/grp01-a/
public = yes
writable = yes
read only = no
printable = no
write list = @grp01
create mask = 0660
directory mask = 0770
;
[grp01公開]
comment = grp01公開
path = /mnt/drive1/samba/grp01-b/
public = yes
writable = yes
read only = no
printable = no
write list = @grp01
create mask = 0664
directory mask = 0775
;
[grp02専用]
comment = grp02専用
path = /mnt/drive1/samba/grp02-a/
public = yes
writable = yes
read only = no
printable = no
write list = @grp02
create mask = 0660
directory mask = 0770
;
[grp02公開]
comment = grp02公開
path = /mnt/drive1/samba/grp02-b/
public = yes
writable = yes
read only = no
printable = no
write list = @grp02
create mask = 0664
directory mask = 0775
;


4.再起動

# reboot