Windows ACLs を利用して共有を設定する

提供: 雑廉堂Wiki
2019年2月28日 (木) 13:46時点におけるMeisina04 (トーク | 投稿記録)による版 (ファイルシステムのサポート)

はじめに

Extended access control lists (ACL) enable you to set permissions on shares, files, and directories using Windows ACLs and applications. Samba supports shares using extended ACLs on: 拡張アクセス制御リスト(ACL)を使用すると、WindowsのACLおよびアプリケーションを使用して、共有、ファイル、およびディレクトリに対するアクセス許可を設定できます。Sambaは、以下で拡張ACLを使用して共有をサポートします。

  • ドメインメンバ
  • Active Directory (AD) ドメインコントローラ (DC)
  • NT4 プライマリドメインコントローラ (PDC)
  • NT4 バックアップドメインコントローラ (BDC)
  • スタンドアローンホスト

拡張ACLの代わりに、POSIX ACLを使用して共有を設定できます。 詳細については、 POSIX ACLs を利用して共有を設定するを見てください。.

ホストの準備

共有を作成する前にSambaを設定する必要があります。 どのタイプのSambaサーバーが必要かに応じて、以下を参照してください:


ファイルシステムのサポート

共有が作成されるファイルシステムは、次のものをサポートしている必要があります。:

  • ユーザーとシステムの xattr 名前空間。
  • 拡張されてアクセスコントロールリスト (ACL).

For further details, see File system support.


拡張ACL(Access Control List)をサポートする共有を作成するには、 smbd サービスがACLサポートを有効にして構築されている必要があります。 Active Directory(AD)ドメインコントローラ(DC)として機能するSambaホストは、拡張ACLサポートにより常に有効になっています。

SambaがACLサポート付きでビルドされたかどうかを確認するには、次のように入力:

# smbd -b | grep HAVE_LIBACL
   HAVE_LIBACL

出力が表示されない場合

  • Sambaは --with-acl-support = no パラメータを使って構築されました。

Sambaの configure スクリプトは、ACLサポートに必要なライブラリを見つけることができませんでした。 詳細はSambaをビルドするのに必要なパッケージ依存関係を参照してください。

smb.conf ファイルで拡張ACLサポートを有効にする File

拡張アクセス制御リスト(ACL)を使って共有を設定するには、 smb.conf ファイルでサポートを有効にする必要があります。 拡張ACLサポートをグローバルに有効にするには、 smb.conf ファイルの [global] セクションに次の設定を追加します。

vfs objects = acl_xattr
map acl inherit = yes
store dos attributes = yes
This message box is using an invalid "type=important" parameter and needs fixing.

あるいは、特定の共有に対してのみ拡張ACLサポートを有効にするには、共有のセクションにパラメータを追加します。

For further details about the parameters, see the smb.conf(5) man page.


SeDiskOperatorPrivilege 権限の付与

SeDiskOperatorPrivilege 権限を付与されたユーザーとグループのみが共有権限を設定できます。

Domain Admins グループに権限を付与するには、次のように入力します。

# net rpc rights grant "SAMDOM\Domain Admins" SeDiskOperatorPrivilege -U "SAMDOM\administrator"
Enter SAMDOM\administrator's password:
Successfully granted rights.
This message box is using an invalid "type=note" parameter and needs fixing.

SeDiskOperatorPrivilege 特権が付与されているすべてのユーザーとグループを一覧表示するには、次のように入力します。

# net rpc rights list privileges SeDiskOperatorPrivilege -U "SAMDOM\administrator"
Enter administrator's password:
SeDiskOperatorPrivilege:
  BUILTIN\Administrators
  SAMDOM\Domain Admins
This message box is using an invalid "type=important" parameter and needs fixing.

共有を追加

Demo 共有名を使用して / srv / samba / Demo / ディレクトリを共有するには、次の手順を実行します。

  • root ユーザーとして、ディレクトリを作成します。
# mkdir -p /srv/samba/Demo/
  • ドメイン管理者以外のアカウントがWindowsで権限を設定できるようにするには、 SeDiskOperatorPrivilege </ codeを付与したユーザーまたはグループにフルコントロール rwx )を付与します。 >特権 例えば:
# chown root:"Domain Admins" /srv/samba/Demo/
# chmod 0770 /srv/samba/Demo/
  • [Demo] 共有定義を smb.conf ファイルに追加します。
[Demo]
       path = /srv/samba/Demo/
       read only = no
共有固有の詳細設定とファイルシステムのアクセス許可は、Windowsのユーティリティを使用して設定します。
This message box is using an invalid "type=important" parameter and needs fixing.
  • Sambaの設定を再読み込みする:
# smbcontrol all reload-config

共有許可とACLの設定

拡張アクセス制御リスト(ACL)をサポートする共有を設定するときは、 smb.conf ファイルの共有セクションにパラメータを追加するのではなく、Windowsユーティリティを使用して共有アクセス権を設定します。

Demo 共有にアクセス許可とACLを設定するには:

  • SeDiskOperatorPrivilege 権限が付与されているアカウントを使用してWindowsホストにログオンします。 例えば SAMDOM \ Administrator または SAMDOM \ john john Domain Admins のメンバーです。
  • [開始]をクリックし、コンピュータの管理と入力してアプリケーションを起動します。
  • [操作 / 別のコンピュータに接続]を選択します。
  • Sambaホストの名前を入力し、 OK をクリックしてコンソールをホストに接続します。
  • システムツール / 共有フォルダ / 共有メニューを開きます。
Computer Management Shares.png
  • Right-click to the share and select Properties.
  • Select the Share Permissions tab and check the share permissions, you need to see Everyone. For example:
Share.png
Samba stores share permissions in the /usr/local/samba/var/locks/share_info.tdb database.
  • Select the Security tab.
  • Click the Edit button and set the file system ACLs on the share's root directory. For example:
Demo Share Security.png
For details about using the SYSTEM account on a Samba share see The SYSTEM Account.
For details where the ACLs are stored, see File System ACLs in the Back End.
  • Click the Add button.
  • Click Advanced button
  • Click Find Now
  • Select a user or group from the list, Domain Users for instance.
  • Click OK
  • Click OK
  • Select permissions to grant, Full control for instance.
  • A windows security box should open, asking if you want to continue, Click Yes
  • If you check the list of Group or user names, you should find Domain Users listed
  • Click OK to close the Permissions for Demo window.
  • Click OK to store the updated settings.

For further details about configuring share permissions and ACLs, see the Windows documentation.

Setting ACLs on a Folder

To set file system permissions on a folder located on a share that uses extended access control lists (ACL):

  • Log on to a Windows host using an account that has Full control on the folder you want to modify the file system ACLs.
  • Navigate to the folder.
  • Right-click to the folder and select Properties.
  • Select the Security tab and click the Edit button.
  • Set the permission. For example:
ファイル:Folder Permissions.png
For details about using the SYSTEM account on a Samba share see The SYSTEM Account.
For details where the ACLs are stored, see File System ACLs in the Back End.
  • Click OK to close the Permissions for Folder window.
  • Click OK to store the updated settings.

For further details about setting ACLs, see the Windows documentation.



File System ACLs in the Back End

Samba stores the file system permissions in extended file system access control lists (ACL) and in an extended attribute. For example:

  • To list the extended ACLs of the /srv/samba/Demo/ directory, enter:
# getfacl /srv/samba/Demo/
# file: srv/samba/Demo/
# owner: root
# group: root
user::rwx
user:root:rwx
group::---
group:root:---
group:domain\040users:rwx
group:domain\040admins:rwx
mask::rwx
other::---
default:user::rwx
default:user:root:rwx
default:group::---
default:group:root:---
default:group:domain\040users:rwx
default:group:domain\040admins:rwx
default:mask::rwx
default:other::---
  • To list the security.NTACL extended attribute of the /srv/samba/Demo/ directory, enter:
# getfattr -n security.NTACL -d /srv/samba/Demo/
# file: srv/samba/Demo/
security.NTACL=0sBAAEAAAAAgAEAAIAAQC4zK0lHchKFvwXwbPR/h8P8sXMj5dNIT5QQuWsYwO3RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcG9zaXhfYWNsAEbGxuGu39MBuiZRk2pYxeL5ZWc4au0ikqRAk53MkjVd2b4quyk2WwcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEABJy0AAAA0AAAAAAAAADsAAAAAQUAAAAAAAUVAAAASSVmaZneO8cxOHk/9AEAAAEFAAAAAAAFFQAAAEklZmmZ3jvHMTh5P0oIAAACAMQABwAAAAALFACpABIAAQEAAAAAAAEAAAAAAAAUAAAAEAABAQAAAAAAAQAAAAAACxQA/wEfAAEBAAAAAAADAAAAAAALFACpABIAAQEAAAAAAAMBAAAAAAMkAP8BHwABBQAAAAAABRUAAABJJWZpmd47xzE4eT9KCAAAAAAkAP8BHwABBQAAAAAABRUAAABJJWZpmd47xzE4eT/0AQAAAAMkAL8BEwABBQAAAAAABRUAAABJJWZpmd47xzE4eT8BAgAA

The previous example of file system ACLs and the extended attribute is mapped to the following Windows ACLs:

Principal Permissions Applies to
Domain Users (SAMDOM\Domain Users) Modify, Read & execute, List folder contents, Read, Write (This folder, subfolders and files)
Domain Admins (SAMDOM\Domain Admins) Full control (This folder, subfolders and files)
  • To get the ACL in a more readable form, enter:
# samba-tool ntacl get /usr/local/samba/var/locks/sysvol --as-sddl
# O:BAG:SYD:PAI(A;OICIIO;WOWDGRGWGX;;;CO)(A;OICIIO;GRGX;;;AU)(A;;0x001200a9;;;AU)(A;OICIIO;GA;;;SY)(A;;0x001f01ff;;;SY)(A;OICIIO;WOWDGRGWGX;;;BA)(A;;0x001e01bf;;;BA)(A;OICIIO;GRGX;;;SO)(A;;0x001200a9;;;SO)



Troubleshooting

For troubleshooting, see: