Idmap config ad
前書き
ad IDマッピングバックエンドは、Active Directory(AD)からアカウントおよびグループ情報を読み取るための読み取り専用API
を実装します。 バックエンドはRFC 2307に基づいています。 詳細については、https://www.rfc-editor.org/rfc/rfc2307.txtを参照してください。
代替案については、アイデンティティマッピングバックエンドを参照してください。
{{#invoke:Message box|imbox}}
{{#invoke:Message box|imbox}}
adバックエンドのメリットとデメリット
利点:
- Active Directory(AD)内のIDの集中管理。
adバックエンドを使用するすべてのSambaクライアントとサーバ上の一貫したID。- 必要な属性は一度作成するだけで済みます。これはユーザーまたはグループの作成時に行うことができます
- IDはローカルにのみキャッシュされ、DCのADデータベースに格納されます。 つまり、ローカルキャッシュが破損してもファイルの所有権は失われません。
欠点:
- Windowsの「Active Directoryユーザーとコンピュータ」(ADUC)プログラムが使用されていない場合、重複を避けるためにID値を手動で追跡する必要があります。
- RFC2307属性の値は手動で設定する必要があります。
Winbind NSS infoモード固有の機能:
rfc2307:ユーザの個々のログインシェルとホームディレクトリパス。template:ログインシェルとホームディレクトリのベースパスはすべてのユーザで同じです。
ID範囲の計画
smb.confファイルでadバックエンドを設定する前に、ドメインごとに一意のID範囲を選択する必要があります。 Sambaがドメイン内に作成された将来のすべてのユーザーおよびグループにIDを割り当てることができるように、範囲は連続的かつ十分に大きくなければなりません。
{{#invoke:Message box|imbox}}
前提条件
SambaがActive Directory(AD)からユーザ情報とグループ情報を取得できるようにするには:
- ユーザーは少なくとも
uidNumber属性セットを持っている必要があります。rfc2307winbind NSS infoモードを使用する場合、ユーザーアカウントにもloginShellとunixHomeDirectoryを設定する必要があります。 - グループには、少なくとも
gidNumber属性セットが必要です。 - コンピュータ、または 'machine network accounts'は、sambaドメインメンバーの共有にアクセスするために
uidNumber属性を設定する必要があります。 - ユーザーとコンピュータのプライマリグループには、
gidNumber属性を設定する必要があります。 - ユーザー、コンピュータ、およびグループIDは、このドメインの
smb.confに設定されている範囲内でなければなりません。 - ユーザーIDとコンピュータIDはすべてのユーザーとコンピュータに対して一意である必要があり、グループIDはすべてのグループに対して一意である必要があります。重複したID、または以前に削除されたアカウントのIDを再利用することで、新しいユーザー、コンピュータ、またはグループは、他のまたは以前のID所有者によって作成されたファイルにアクセスできます。 ADUCユーティリティを使用すると、ユーザーIDとグループIDはAD内で自動的に追跡され、新しいユーザーまたはグループを作成するときに増加します。
- コンピュータID(
uidNumber属性)はAD内で自動的に追跡されないため、コンピュータがドメインに参加しているときはADUC Attribute Editorタブで手動で設定する必要があります。
{{#invoke:Message box|imbox}}
RFC2307とtemplateモードのオプション
Sambaバージョン4.6.0より前:
adIDマッピングバックエンドは、smb.confの[global]セクションのwinbind nss infパラメータににセットされた2つのモードをサポートしています:
winbind nss info = rfc2307: Active Directory(AD)からすべての情報が読み込まれます。
- Users: アカウント名、UID、ログインシェル、ホームディレクトリのパス、およびプライマリグループ。
- Groups:グループ名とGID
winbind nss info = template: ADから次の値のみ読み込まれます。
- Users:アカウント名、UID、およびプライマリグループ。
- ログインシェルとホームディレクトリは、
smb.conf内にユーザーから独立した設定によって自動的にセットされます。
- Groups:グループ名とGID
Samba バージョン 4.6.0から:
すでにwinbind nss infoパラメータは使用しなくなり、すでにidmap config DOMAIN:unix_nss_infoに置き換えられました。
ad IDマッピングバックエンドはsmb.confファイルの [global]セクションの idmap config DOMAIN:unix_nss_infoパラメータにセットされた2つのモードをサポートしています:
idmap config DOMAIN:unix_nss_info = yes: すべての情報がActive Directory(AD)から読み込まれます:
- Users: アカウント名、UID、ログインシェル、ホームディレクトリパス、およびプライマリグループ。
- Group: グループ名とGID。
- これらの設定はDOMAIN単位で設定されます。つまり、DOMAINごとに異なる設定を行うことができます。
- ユーザがRFC2307の属性を欠いている場合、ログインシェルとホームディレクトリは、
smb.confファイルのユーザに依存しない設定によって自動的に設定されます。
idmap config DOMAIN:unix_nss_info = no: 次の値だけがADから読み込まれます。
- Users: アカウント名、UID、およびプライマリグループ。
- ログインシェルとホームディレクトリは、
smb.confファイルのユーザーに依存しない設定によって自動的に設定されます。
- Group: グループ名とGID
- これがデフォルト設定です。
新しい設定 unix_primary_groupが追加されました。これにより、ドメインユーザーの代わりにユーザーのプライマリグループに別のグループを使用することができます。
- これがunix_primary_group = yesで設定されている場合、ユーザープライマリグループは、ユーザーADオブジェクトにあるgidNumber属性から取得されます。
- これがunix_primary_group = noで設定されている場合、ユーザープライマリグループは「primaryGroupID」属性を使用して計算されます。
- デフォルトは 'no'です。
adバックエンドの設定
Before Samba version 4.6.0:
- To configure the
adback end using the10000-999999ID range for theSAMDOMdomain, set the following in the[global]section of yoursmb.conffile:
security = ADS workgroup = SAMDOM realm = SAMDOM.EXAMPLE.COM log file = /var/log/samba/%m.log log level = 1 winbind nss info = rfc2307 # Default ID mapping configuration for local BUILTIN accounts # and groups on a domain member. The default (*) domain: # - must not overlap with any domain ID mapping configuration! # - must use a read-write-enabled back end, such as tdb. idmap config * : backend = tdb idmap config * : range = 3000-7999 # - You must set a DOMAIN backend configuration # idmap config for the SAMDOM domain idmap config SAMDOM:backend = ad idmap config SAMDOM:schema_mode = rfc2307 idmap config SAMDOM:range = 10000-999999 vfs objects = acl_xattr map acl inherit = yes store dos attributes = yes
From Samba version 4.6.0:
- To configure the
adback end using the10000-999999ID range for theSAMDOMdomain, set the following in the[global]section of yoursmb.conffile:
security = ADS workgroup = SAMDOM realm = SAMDOM.EXAMPLE.COM log file = /var/log/samba/%m.log log level = 1 # Default ID mapping configuration for local BUILTIN accounts # and groups on a domain member. The default (*) domain: # - must not overlap with any domain ID mapping configuration! # - must use a read-write-enabled back end, such as tdb. idmap config * : backend = tdb idmap config * : range = 3000-7999 # - You must set a DOMAIN backend configuration # idmap config for the SAMDOM domain idmap config SAMDOM:backend = ad idmap config SAMDOM:schema_mode = rfc2307 idmap config SAMDOM:range = 10000-999999 idmap config SAMDOM:unix_nss_info = yes vfs objects = acl_xattr map acl inherit = yes store dos attributes = yes
{{#invoke:Message box|imbox}}
{{#invoke:Message box|imbox}}
- Configure the Winbind NSS info mode:
- To enable the
templatemode and set, for example,/bin/bashas shell and/home/%Uas home directory path:
- To enable the
# Template settings for login shell and home directory template shell = /bin/bash template homedir = /home/%U
- The settings are applied to all users in each domain that has the
schema_mode = rfc2307parameter set. From Samba 4.6.0, the global template settings can be overwritten on a domain-basis by enabling theidmap config domain_name:unix_nss_infoparameter.
- The settings are applied to all users in each domain that has the
- Samba resolves the
%Uvariable to the session user name. For details, see theVARIABLE SUBSTITUTIONSsection in thesmb.conf(5)man page.
- Samba resolves the
- By default, Samba sets the Windows primary group as primary group for mapped domain user entries on Unix. The Windows primary group is retrieved from the
primaryGroupIDattribute of each user entry, this is usually set to theDomain Usersgroup RID. This RID is then used to obtain thegidNumberattribute from the Windows primary group.
- If you are running Samba 4.6.0 or later, you can optionally configure Samba to use the primary group set in the
gidNumberattribute in the users entry instead. For example, when using theActive Directory Users and Computersapplication, this attribute is displayed in theUNIX Attributestab. To use the group ID set in the usersgidNumberattribute as primary group for each user instead of the Windows primary group, enable the following parameter in the[global]section in yoursmb.conffile:
idmap config SAMDOM:unix_primary_group = yes
{{#invoke:Message box|imbox}}
{{#invoke:Message box|imbox}}
- Reload Samba:
# smbcontrol all reload-config
For further details, see the smb.conf(5) and idmap_ad(5) man page.