「Sambaをドメインメンバーとして設定」の版間の差分

提供: 雑廉堂Wiki
(Setting up a Basic smb.conf File)
 
(同じ利用者による、間の20版が非表示)
15行目: 15行目:
 
{{Imbox
 
{{Imbox
 
| type = content
 
| type = content
 +
| style = 4px 2%
 
| text = Unixドメインメンバーを作成するために、決して<code>samba-tool domain provision</code>コマンドを使わないでください。機能しません。このページに記載されている手順に従ってください。
 
| text = Unixドメインメンバーを作成するために、決して<code>samba-tool domain provision</code>コマンドを使わないでください。機能しません。このページに記載されている手順に従ってください。
 
}}
 
}}
49行目: 50行目:
 
{{:LinuxとUnixのDNS設定}}
 
{{:LinuxとUnixのDNS設定}}
  
=== Configuring Kerberos ===
+
=== Kerberosを設定 ===
  
 
SambaはHeimdalとMIT Kerberosのバックエンドをサポートしています。 ドメインメンバーにKerberosを設定するには、<code> /etc/krb5.conf </code>ファイルに次のように設定します。
 
SambaはHeimdalとMIT Kerberosのバックエンドをサポートしています。 ドメインメンバーにKerberosを設定するには、<code> /etc/krb5.conf </code>ファイルに次のように設定します。
105行目: 106行目:
 
= Sambaを設定 =
 
= Sambaを設定 =
  
== Setting up a Basic <code>smb.conf</code> File ==
+
== 基本的な<code> smb.conf </code>ファイルの設定 ==
  
 
Unixドメインメンバー上でsmb.confを設定するとき、あなたは何点か決めておく必要があります。
 
Unixドメインメンバー上でsmb.confを設定するとき、あなたは何点か決めておく必要があります。
136行目: 137行目:
 
どちらのwinbindバックエンドを使うか決めたら、smb.confの 'idmap config'で使用する範囲を決めます。
 
どちらのwinbindバックエンドを使うか決めたら、smb.confの 'idmap config'で使用する範囲を決めます。
 
Unixドメインメンバーのデフォルトでは、ユーザーとグループのブロックは複数あります:
 
Unixドメインメンバーのデフォルトでは、ユーザーとグループのブロックは複数あります:
 +
  
 
* ローカルシステムのユーザーとグループ:これらは0から999までとなります
 
* ローカルシステムのユーザーとグループ:これらは0から999までとなります
145行目: 147行目:
  
  
As you can see from the above, you shouldn't set either the '*' or 'DOMAIN' ranges to start at 999 or less, as they would interfere with the local system users & groups. You also should leave a space for any local Unix users & groups, so starting the 'idmap config' ranges at 3000 seems to be a good compromise.
+
上記からわかるように、 '*'または 'DOMAIN'の範囲を999以下に設定しないでください。ローカルシステムのユーザーおよびグループに干渉します。 ローカルのUnixユーザーやグループのためにもスペースを空けておくべきです。ですから 'idmap config'の範囲を3000から始めるのは良い妥協のようです。
  
You need to decide how large your 'DOMAIN' is likely to grow to and you also need to know if you have any trusted domains or if you may need to have any in future.
+
あなたは、自身の'DOMAIN'がどれくらい大きくなる可能性があるか、決める必要があります。また、さらにどれくらいの信頼できるドメインを持っており、あるいは将来的に必要になるのかどうか知っておく必要があります。
  
Bearing the above information in mind, you could set the 'idmap config' ranges to the following:
+
上記の情報を念頭に置いて、 'idmap config'の範囲を次のように設定できます。
  
 
:{| class="wikitable"
 
:{| class="wikitable"
172行目: 174行目:
 
|}
 
|}
  
If you set the '*' range above the 'DOMAIN' range, the ranges will conflict if the 'Domain' grows to the point that the next ID would be the same as the '*' range start ID.
+
'*'の範囲を 'DOMAIN'の範囲より上に設定した場合、 'Domain'が次のIDが '*'の範囲の開始IDと同じになるまで成長すると、範囲が競合します。
 
+
With the above suggested ranges, no range will overlap or interfere with another.
+
上記で示唆された範囲では、どの範囲も他の範囲と重複することも干渉することもない。
  
You may also have seen examples of the '*' range being used for everything, this is not recommended and should not be used.
+
'*'の範囲がすべてに使用されている例も見たことがあるかもしれませんが、これはお勧めできませんし、使用しないでください。
  
  
Before joining the domain, configure the domain member's <code>smb.conf</code> file:
+
ドメインに参加する前に、ドメインメンバーの<code> smb.conf </code>ファイルを設定します。
  
* To locate the file, enter:
+
* ファイルを見つけるには、次のように入力します。
  
 
  # smbd  -b | grep CONFIGFILE
 
  # smbd  -b | grep CONFIGFILE
 
   CONFIGFILE: /usr/local/samba/etc/smb.conf
 
   CONFIGFILE: /usr/local/samba/etc/smb.conf
  
== Choose backend for id mapping in winbindd ==
+
== winbinddでIDマッピング用のバックエンドを選択 ==
  
'''After reading this wikipage, click on one of the following hyperlinks to find information about the relevant Samba domain back end:'''
+
'''このウィキページを読んだ後、以下のハイパーリンクのいずれかをクリックして、関連するSambaドメインのバックエンドに関する情報を見つけてください。:'''
  
 
:{| class="wikitable"
 
:{| class="wikitable"
209行目: 211行目:
  
 
:{{Imbox
 
:{{Imbox
| type = important
+
| type = content
| text = Add an additional ID mapping configuration for every domain. The ID ranges of the default (<code>*</code>) domain and other domains configured in the <code>smb.conf</code> file must not overlap.
+
| text = ドメインごとに追加のIDマッピング構成を追加します。 <code> smb.conf </code>ファイルに設定されている、デフォルトの(<code> * </code>)ドメインと他のドメインのID範囲は重複してはいけません。
 
}}
 
}}
  
== Mapping the Domain Administrator Account to the Local <code>root</code> User ==
+
== Domain Administrator アカウントをローカルの <code>root</code> ユーザーにマッピングする ==
  
Samba enables you to map domain accounts to a local account. Use this feature to execute file operations on the domain member's file system as a different user than the account that requested the operation on the client.
+
Sambaではドメインアカウントをローカルアカウントにマッピングすることができます。 この機能を使用して、クライアントで操作を要求したアカウントとは異なるユーザーとしてドメインメンバーのファイルシステムでファイル操作を実行します。
  
 
{{Imbox
 
{{Imbox
 
| type = note
 
| type = note
| text = Mapping the domain administrator to the local <code>root</code> account is optional. Only configure the mapping if the domain administrator must be able to execute file operations on the domain member using <code>root</code> permissions. You should be aware that mapping Administrator to the <code>root</code> account will not allow you to log onto Unix domain members as <code>Administrator</code>.
+
| text = ドメイン管理者をローカルの <code>root</code> アカウントにマッピングすることはオプションです。 ドメイン管理者が <code>root</code> 権限を使用してドメインメンバーに対してファイル操作を実行できる必要がある場合にのみマッピングを設定します。 Administratorを <code>root</code> アカウントにマッピングしても、UNIXドメインメンバーに <code>Administrator</code> としてログオンすることはできません。
 
}}
 
}}
  
To map the domain administrator to the local <code>root</code> account:
+
ドメイン管理者をローカルの <code>root</code> アカウントにマッピングするには、次の手順を実行します。
  
* Add the following parameter to the <code>[global]</code> section of your <code>smb.conf</code> file:
+
* <code>smb.conf</code> ファイルの <code>[global]</code> セクションに次のパラメータを追加します。
  
 
  username map = /usr/local/samba/etc/user.map
 
  username map = /usr/local/samba/etc/user.map
  
* Create the <code>/usr/local/samba/etc/user.map</code> file with the following content:
+
* 以下の内容で<code>/usr/local/samba/etc/user.map</code>ファイルを作成します。:
 
   
 
   
 
  !root = SAMDOM\Administrator
 
  !root = SAMDOM\Administrator
234行目: 236行目:
 
:{{Imbox
 
:{{Imbox
 
| type = important
 
| type = important
| text = When using the <code>ad</code> ID mapping back end, do not set the <code>uidNumber</code> attribute for the domain administrator account. If the account has the attribute set, the value overrides the local UID <code>0</code> of the <code>root</code> user and thus the mapping fails.
+
| text = バックエンドの<code> ad </code> IDマッピングを使用するときは、ドメイン管理者アカウントに<code> uidNumber </code>属性を設定しないでください。 アカウントに属性が設定されている場合、値は<code> root </code>ユーザーのローカルUID <code> 0 </code>をオーバーライドするため、マッピングは失敗します。
 
}}
 
}}
  
For further details, see <code>username map</code> parameter in the <code>smb.conf(5)</code> man page.
+
詳細は、<code>smb.conf(5</code>のmanページの<code>username map</code>パラメータをご覧ください。
  
= Joining the Domain =
+
= ドメインに参加 =
  
* To join the host to an Active Directory (AD), enter:
+
* ホストをActive Directory(AD)に参加させるには次のように入力:
  
 
  # net ads join -U administrator
 
  # net ads join -U administrator
248行目: 250行目:
 
  Joined 'M1' to dns domain 'samdom.example.com'
 
  Joined 'M1' to dns domain 'samdom.example.com'
  
* To join the host to an NT4 domain, enter:
+
* ホストをNT4ドメインに参加させるには次のように入力:
  
 
  # net rpc join -U administrator
 
  # net rpc join -U administrator
255行目: 257行目:
  
 
{{Imbox
 
{{Imbox
| type = important
+
| type = content
| text = Do not provision or join a domain member using the <code>samba-tool</code> utility. These options are unsupported and can cause problems with your AD replication. The options will be removed from <code>samba-tool</code> in a future release.
+
| text = <code>samba-tool</code>ユーティリティを使用してドメインメンバーをプロビジョニングまたは参加させないでください。 これらのオプションはサポートされておらず、ADのレプリケーションに問題を引き起こす可能性があります。 このオプションは将来のリリースでは<code>samba-tool</code>から削除される予定です。
 
}}
 
}}
  
If you have problems joining the domain, check your configuration. For further help, see [[Troubleshooting_Samba_Domain_Members|Troubleshooting Samba Domain Members]].
+
ドメインへの参加に問題がある場合は、設定を確認してください。 さらなるヘルプについては、[[Sambaドメインメンバのトラブルシューティング| Sambaドメインメンバのトラブルシューティング]]を参照してください。
 
 
 
 
 
 
 
 
  
= Configuring the Name Service Switch =
+
= ネームサービススイッチの設定 =
  
To enable the name service switch (NSS) library to make domain users and groups available to the local system:
+
ネームサービススイッチ(NSS)ライブラリを有効にして、ドメインユーザーとグループがローカルシステムで使用できるようにするには;
  
* Append the <code>winbind</code> entry to the following databases in the <code>/etc/nsswitch.conf</code> file:
+
* <code>winbind</code>のエントリを<code>/etc/nsswitch.conf</code>ファイルの以下のデータベースに追加します:
  
 
  passwd: files <u>winbind</u>
 
  passwd: files <u>winbind</u>
 
  group:  files <u>winbind</u>
 
  group:  files <u>winbind</u>
  
:* Keep the <code>files</code> entry as first source for both databases. This enables NSS to look up domain users and groups from the <code>/etc/passwd</code> and <code>/etc/group</code> files before querying the Winbind service.
+
:* それぞれ両方のデータベースの最初のソースは、<code>files</code>エントリのままにしておいてください。これにより、NSSはWinbindサービスに問い合わせをする前に、<code>/etc/passwd</code><code>/etc/group</code>ファイルからドメインユーザーおよび、ドメイングループを検索できます。
  
:* Do not add the <code>winbind</code> entry to the NSS <code>shadow</code> database. This can cause the <code>wbinfo</code> utility fail.
+
:* <code>winbind</code>のエントリを<code>shadow</code>データベースに追加してはいけません。これによって、<code>wbinfo</code>ユーティリティーが失敗する可能性があります。
  
 
:{{Imbox
 
:{{Imbox
| type = note
+
| type = notice
| text = Do not use the same user names in the local <code>/etc/passwd</code> file as in the domain.
+
| text = ローカルシステムの<code>/etc/paswwd</code>で、ドメイン内と同じユーザー名を使用しないでください。
 
}}
 
}}
  
 
:{{Imbox
 
:{{Imbox
| type = note
+
| type = notice
| text = If you compiled Samba, add symbolic links from the <code>libnss_winbind</code> library to the operating system's library path. For details, see [[Libnss_winbind_Links|libnss_winbind Links]]. If you used packages to install Samba, the link is usually created automatically.
+
| text = Sambaをコンパイルした場合は、<code>libnss_winbind</code>ライブラリからオペレーティングシステムのライブラリパスへのシンボリックリンクを追加します。 詳細は[[Libnss_winbind_リンク |Libnss winbind リンク]]を参照してください。 Sambaをインストールするためにパッケージを使用した場合、リンクは通常自動的に作成されます。
 
}}
 
}}
 
 
 
 
 
  
 
= Starting the Services =
 
= Starting the Services =
  
Start the following services to have a fully functioning Unix domain member:
+
Unixドメインメンバが完全に機能させるために、次のサービスを開始してください:
  
* The <code>smbd</code> service
+
* <code>smbd</code> サービス
 
   
 
   
* The <code>nmbd</code> service
+
* <code>nmbd</code> サービス
  
* The <code>winbindd</code> service
+
* <code>winbindd</code> サービス
  
  
 
:{{Imbox
 
:{{Imbox
 
| type = note
 
| type = note
| text = If you do not require Network Browsing, you do not need to start the <code>nmbd</code> service on a Unix domain member.
+
| text = ネットワークブラウジングが不要な場合は、<code>nmbd</code>をドメインメンバーで開始する必要はありません。
 
}}
 
}}
  
312行目: 305行目:
 
:{{Imbox
 
:{{Imbox
 
| type = note
 
| type = note
| text = You must not start the <code>samba</code> service on a domain member. This service is required only on Active Directory (AD) domain controllers (DC).
+
| text = <code>samba</code> サービスを開始させてはいけません。このサービスは、Active Directory (AD) ドメインコントローラ (DC) で必要とされるものです。
 
}}
 
}}
  
  
Samba does not provide System V init scripts, <code>systemd</code>, <code>upstart</code>, or service files for other init services.
+
Sambaは、System V initスクリプト、<code>systemd</code><code>upstart</code>、あるいはその他initサービス用のサービスファイルを提供していません。
* If you installed Samba using packages, use the script or service configuration file provided by the package to start Samba.
+
* パッケージを使用してSambaをインストールした場合は、Sambaを起動するためにパッケージによって提供されるスクリプトまたはサービス設定ファイルを使用してください。
* If you built Samba, see your distribution's documentation for how to create a script or configuration to start services.
+
* Sambaをビルドした場合は、サービスを開始するためのスクリプトまたは設定の作成方法について、ディストリビューションのドキュメントを参照してください。
 
 
 
 
 
 
 
 
  
= Testing the Winbindd Connectivity =
+
= Winbindへの接続を確認 =
  
== Sending a Winbindd Ping ==
+
== Winbindd Ping を送信する ==
  
To verify if the Winbindd service is able to connect to Active Directory (AD) Domain Controllers (DC) or a primary domain controller (PDC), enter:
+
WinbinddサービスがActive Directory(AD)ドメインコントローラ(DC)またはプライマリドメインコントローラ(PDC)に接続できるかどうかを確認するには、次のように入力します。
  
 
  # wbinfo --ping-dc
 
  # wbinfo --ping-dc
 
  checking the NETLOGON for domain[SAMDOM] dc connection to "DC.SAMDOM.EXAMPLE.COM" succeeded
 
  checking the NETLOGON for domain[SAMDOM] dc connection to "DC.SAMDOM.EXAMPLE.COM" succeeded
  
If the previous command fails, verify:
+
前のコマンドが失敗した場合は、次の点を確認してください。
* That the <code>winbindd</code> service is running.
+
* <code>winbindd</code>サービスが実行されていること。
* Your <code>smb.conf</code> file is set up correctly.
+
* <code>smb.conf</code>ファイルは正しく設定されていること。
  
  
  
== Using Domain Accounts and Groups in Operating System Commands ==
+
== オペレーティングシステムのコマンドでドメインアカウントとグループを使用する ==
  
=== Looking up Domain Users and Groups ===
+
=== ドメインユーザーとグループを調べる ===
  
The <code>libnss_winbind</code> library enables you to look up domain users and groups. For example:
+
<code>libnss_winbind</code>ライブラリを使用すると、ドメインのユーザーとグループを検索できます。 例えば:
  
* To look up the domain user <code>SAMDOM\demo01</code>:
+
* ドメインユーザー<code>SAMDOM\demo01</code>を検索するには:
  
 
  # getent passwd SAMDOM\\demo01
 
  # getent passwd SAMDOM\\demo01
 
  SAMDOM\demo01:*:10000:10000:demo01:/home/demo01:/bin/bash
 
  SAMDOM\demo01:*:10000:10000:demo01:/home/demo01:/bin/bash
  
* To look up the domain group <code>Domain Users</code>:
+
* <code>Domain Users</code>のグループを検索するには:
  
 
  # getent group "SAMDOM\\Domain Users"
 
  # getent group "SAMDOM\\Domain Users"
357行目: 346行目:
  
  
=== Assigning File Permissions to Domain Users and Groups ===
+
=== ドメインユーザーとグループにファイルのアクセス許可を割り当てる ===
  
The name service switch (NSS) library enables you to use domain user accounts and groups in commands. For example to set the owner of a file to the <code>demo01</code> domain user and the group to the <code>Domain Users</code> domain group, enter:
+
ネームサービススイッチ(NSS)ライブラリを使用すると、コマンドでドメインユーザーアカウントとグループを使用できます。たとえば、ファイルの所有者を<code>demo01</code>ドメインユーザーに、グループを<code>Domain Users</code>ドメイングループに設定するには、次のように入力します。
  
 
  # chown "SAMDOM\\demo01:SAMDOM\\domain users" file.txt
 
  # chown "SAMDOM\\demo01:SAMDOM\\domain users" file.txt
  
 +
= ドメインメンバーに追加サのービスを設定する =
  
 +
Sambaドメインメンバーに、追加の設定ができます。
 +
* ファイル共有はファイルサーバーとして機能します。 詳細は[[Sambaファイルサーバ | Sambaファイルサーバ]]を参照のこと。
 +
* プリントサービスはプリントサーバーとして機能します。 詳細は[[Print_Server_Support |プリントサーバーサポート]]を参照してください。
 +
* ローカルサービスに対するドメインユーザーのPAM認証。 詳細については、[[PAMを使用したドメインユーザーの認証 | PAMを使用したドメインユーザーの認証]]を参照してください。
  
 +
=トラブルシューティング=
  
 
+
詳細については、[[Sambaドメインメンバのトラブルシューティング | Sambaドメインメンバのトラブルシューティング]]を参照してください。
= Setting up Additional Services on the Domain Member =
 
 
 
On a Samba domain member, you can additionally set up:
 
* File shares to act as a file server. For details, see [[Samba_File_Serving|Samba File Serving]].
 
* Print services to act as a print server. For details, see [[Print_Server_Support|Print Server Support]].
 
* PAM authentication of domain users for local services. For details, see [[Authenticating_Domain_Users_Using_PAM|Authenticating Domain Users Using PAM]].
 
 
 
 
 
 
 
 
 
 
 
= Troubleshooting =
 
 
 
For details, see [[Troubleshooting_Samba_Domain_Members|Troubleshooting Samba Domain Members]].
 
  
  

2019年3月1日 (金) 19:00時点における最新版

はじめに

Sambaドメインメンバーは、Sambaを実行していて、なおかつNT4のプライマリドメインコントローラ(PDC)や、あるいはActive Directory(AD)ドメインコントローラ(DC)のようなドメインサービスを提供することのない、ドメインに参加しているLinuxマシンです。

Sambaドメインメンバーでは次の事ができます:

  • ファイルとディレクトリのローカルアクセス制御リストでユーザとグループを使用します。
  • ファイルサーバーとして機能するように共有を設定します。
  • プリントサーバーとして機能するように印刷サービスを設定します。
  • ドメインユーザーがローカルにログオンできるように、あるいは、ローカルにインストールされているサービスに対して認証できるようにPAMを設定します。

Samba NT4 ドメイン、あるいはSamba ADをセットアップすることについては、ドメインコントロールを見てください。


インストールの準備

一般的な準備

  • Sambaプロセスが一つも動作していないことを確認:
# ps ax | egrep "samba|smbd|nmbd|winbindd"
もし、sambasmbdnmbdや、winbinddのようなプロセスが表示されるのであれば、それらのプロセスを停止させてください。
  • もし、以前にこのホスト上でSambaのインストールを実行したのであれば:
  • smb.confを削除してください。ファイルへのパスを表示させるには、次のように入力:
# smbd -b | grep "CONFIGFILE"
   CONFIGFILE: /usr/local/samba/etc/samba/smb.conf
  • *.tdbと、*.ldbファイルのような、Sambaデータベースファイルを削除してください。Sambaデータベースのあるフォルダを表示させるには:
# smbd -b | egrep "LOCKDIR|STATEDIR|CACHEDIR|PRIVATE_DIR"
  LOCKDIR: /usr/local/samba/var/lock/
  STATEDIR: /usr/local/samba/var/locks/
  CACHEDIR: /usr/local/samba/var/cache/
  PRIVATE_DIR: /usr/local/samba/private/
クリーンな環境からスタートするのは、混乱を防ぐのに役立ちますし、また、以前のSambaのインストールからのどのファイルも、新たなドメインメンバーのインストールと混在することはありません。


ActiveDirectoryドメインに参加するドメインメンバーの準備

DNSの設定

Active Directory(AD)はバックグラウンドでDNSを使用して、Kerberosなどの他のDCおよびサービスを見つけます。 したがって、ADドメインメンバーとサーバーはAD DNSゾーンを解決できなければなりません。

以下に、DNSサーバーを使用するようにLinuxクライアントを手動で構成する方法を説明します。 クライアントコンピュータにDNS設定を提供するDHCPサーバーを実行している場合は、DNSサーバーのIPアドレスを送信するようにDHCPサーバーを構成します。

/etc/resolv.conf の設定

/etc/resolv.conf にDNSサーバーのIPアドレスとAD DNSドメインを設定します。 例えば:

nameserver 10.99.0.1
search samdom.example.com

NetworkManagerなどの一部のユーティリティは、そのファイルの手動で変更した内容を上書きすることがあります。 永続的に名前解決を設定する方法については、ディストリビューションのドキュメントを参照してください。

DNSの名前解決をテスト

DNS設定が正しく、クライアントまたはサーバーがIPアドレスとホスト名を解決できることを確認するには、 nslookup コマンドを使用します。 このコマンドはLinuxとWindowsで利用可能です。



前方参照

ホスト名を、そのIPアドレスに解決するには:

# nslookup DC1.samdom.example.com
Server:         10.99.0.1
Address:        10.99.0.1#53

Name:   DC1.samdom.example.com
Address: 10.99.0.1



後方参照

IPアドレスをそのホスト名に解決するには:

# nslookup 10.99.0.1
Server:        10.99.0.1
Address:	10.99.0.1#53

1.0.99.10.in-addr.arpa	name = DC1.samdom.example.com.

Samba ADでは、リバースゾーンは自動的には設定されません。 逆ゾーンを設定するには、DNSの管理を参照してください。



SRVレコードの解決

Active Directory(AD)はSRVレコードを使用してKerberosやLDAPなどのサービスを見つけます。 SRVレコードが正しく解決されたことを確認するには、 nslookup インタラクティブシェルを使用します:

# nslookup
Default Server:  10.99.0.1
Address:  10.99.0.1

> set type=SRV
> _ldap._tcp.samdom.example.com.
Server:  UnKnown
Address:  10.99.0.1

_ldap._tcp.samdom.example.com   SRV service location:
          priority       = 0
          weight         = 100
          port           = 389
          svr hostname   = dc1.samdom.example.com
samdom.example.com      nameserver = dc1.samdom.example.com
dc1.samdom.example.com  internet address = 10.99.0.1

エラーメッセージ

  • DNSサーバーはホスト名を解決できません:
** server can't find DC1.samdom.example.com: NXDOMAIN
  • DNSサーバーはIPアドレスを解決できません:
** server can't find 1.0.99.10.in-addr.arpa: NXDOMAIN
  • 使用されているDNSサーバーが利用できません:
;; connection timed out; no servers could be reached




Kerberosを設定

SambaはHeimdalとMIT Kerberosのバックエンドをサポートしています。 ドメインメンバーにKerberosを設定するには、 /etc/krb5.conf ファイルに次のように設定します。

[libdefaults]
	default_realm = SAMDOM.EXAMPLE.COM
	dns_lookup_realm = false
	dns_lookup_kdc = true

前の例では、 SAMDOM.EXAMPLE.COM レルムにKerberosを設定しています。

Sambaチームは、 /etc/krb5.conf ファイルにこれ以上パラメータを設定しないことをお勧めします。

/etc/krb5.conf include 行が含まれていても機能しません。この行を削除する必要があります。

時刻の同期の設定

Kerberosでは、すべてのドメインメンバで時刻の同期が必要です。 したがって、NTPクライアントを設定することをお勧めします。 詳細については、 Unixドメインメンバーでの時刻同期の設定を参照してください。

ローカルホストの名前解決

ホストをドメインに参加させると、SambaはAD DNSゾーンにホスト名を登録しようとします。 これを行うには、 net ユーティリティがDNSを使用するか /etc/hosts ファイルの正しいエントリを使用してホスト名を解決できる必要があります。

ホスト名が正しく解決されたことを確認するには、 getent hosts コマンドを使用してください。 例えば:

# getent hosts M1
10.99.0.5      M1.samdom.example.com    M1

ホスト名とFQDNは、 127.0.0.1 IPアドレス、またはドメインメンバーのLANインターフェースで使用されているもの以外のIPアドレスに解決されてはなりません。

出力が表示されない、またはホストが間違ったIPアドレスに解決され、dhcpを使用していない場合は、 / etc / hosts ファイルに正しいエントリを設定してください。 例えば:

127.0.0.1      localhost
10.99.0.5      M1.samdom.example.com    M1

dhcpを使用している場合は、 / etc/hosts に上記の '127.0.0.1'行のみが含まれていることを確認してください。 問題が解決しない場合は、DHCPサーバーを管理しているシステム管理者に連絡してください。

  • Debian関連システムでは、/etc/hostsに 127.0.1.1 hostname という行も表示されますので、sambaをインストールする前に削除してください。
  • 127.0.0.1 localhost の行を残してください。

マシンのホスト名にエイリアスを追加する必要がある場合は、127.0.0.1の行ではなく、マシンのipaddressで始まる行の末尾に追加してください。

NT4ドメインに参加するためのドメインメンバーの準備

ホストをNT4ドメインに参加させるには、準備は必要ありません。

Sambaのインストール

詳細については、 Sambaのインストール を参照してください。

Sambaを設定

基本的な smb.conf ファイルの設定

Unixドメインメンバー上でsmb.confを設定するとき、あなたは何点か決めておく必要があります。

  • Samba AD DCを含め、すべての場所でユーザーとグループが同じIDを持つ必要がありますか?
  • あなたのユーザとグループだけがUnixドメインメンバー上で同じIDを持ちたいですか?

あなたの決断をした後、あなたは決断をするための別の決断をするでしょう。この決断はあなたがすでに決断したと思うことに影響を与えるかもしれません。

  • 個々のユーザに異なるログインシェルやUnixホームディレクトリパスを持たせたい、または必要としますか

ユーザに異なるログインシェルやUnixホームディレクトリパスを持たせる必要がある場合、またはどこでも同じIDを持つようにしたい場合は、winbindの 'ad'バックエンドを使用してADにRFC2307属性を追加する必要があります。


ユーザーが認証のためだけにSamba AD DCを使用し、データを保存したり、ログインしたりしない場合、winbindの 'rid' バックエンドを使用することが出来ます。これは、ユーザーとグループのIDをWindows RIDから算出し、すべてのUnixドメインメンバーのsmb.confで、同じ[global]セクションを使用すれば、同じIDを取得することができます。 'rid'バックエンドを使うのであれば、ADに何か追加する必要はありません。実際、RFC2307の属性はすべて無視されます。 'rid'バックエンドを使用するときは、smb.confで 'template shell'と 'template homedir'パラメータを設定しなければなりません。これらはグローバル設定で、個々にホームディレクトリとシェルを設定できる、RFC2307属性とは異なって、全員が同じログインシェルとUnixホームディレクトリパスを取得します。

別にもう一つ、Sambaを設定する方法があります。これは、ユーザーとグループがどこでも同じIDを持たせたいが、同じログインシェルとUnixホームディレクトリパスを使用することのみ必要とするところです。これを行うには、winbindの 'ad'バックエンドを使用し、smb.confのテンプレート行を使用します。これにより、uidNumberおよびgidNumbers属性をADに追加するだけで済みます。

どちらのwinbindバックエンドを使うか決めたら、smb.confの 'idmap config'で使用する範囲を決めます。 Unixドメインメンバーのデフォルトでは、ユーザーとグループのブロックは複数あります:


  • ローカルシステムのユーザーとグループ:これらは0から999までとなります
  • ローカルのUnixユーザーとグループ: これらは1000から始まります
  • 既知のSID: ????
  • ドメインユーザーとグループ: ADUCでは、デフォルト10000から開始します
  • 信頼されるドメイン: ????
  • 既知のSID、DOMAINのメンバー、信頼できるドメイン以外のものは何でも:????


上記からわかるように、 '*'または 'DOMAIN'の範囲を999以下に設定しないでください。ローカルシステムのユーザーおよびグループに干渉します。 ローカルのUnixユーザーやグループのためにもスペースを空けておくべきです。ですから 'idmap config'の範囲を3000から始めるのは良い妥協のようです。

あなたは、自身の'DOMAIN'がどれくらい大きくなる可能性があるか、決める必要があります。また、さらにどれくらいの信頼できるドメインを持っており、あるいは将来的に必要になるのかどうか知っておく必要があります。

上記の情報を念頭に置いて、 'idmap config'の範囲を次のように設定できます。

Domain Range
* 3000-7999
DOMAIN 10000-999999

You could also have any trusted domains starting at:

Domain Range
TRUSTED 1000000-9999999

'*'の範囲を 'DOMAIN'の範囲より上に設定した場合、 'Domain'が次のIDが '*'の範囲の開始IDと同じになるまで成長すると、範囲が競合します。

上記で示唆された範囲では、どの範囲も他の範囲と重複することも干渉することもない。

'*'の範囲がすべてに使用されている例も見たことがあるかもしれませんが、これはお勧めできませんし、使用しないでください。


ドメインに参加する前に、ドメインメンバーの smb.conf ファイルを設定します。

  • ファイルを見つけるには、次のように入力します。
# smbd  -b | grep CONFIGFILE
  CONFIGFILE: /usr/local/samba/etc/smb.conf

winbinddでIDマッピング用のバックエンドを選択

このウィキページを読んだ後、以下のハイパーリンクのいずれかをクリックして、関連するSambaドメインのバックエンドに関する情報を見つけてください。:

Back End Documentation Man Page
ad idmap config ad idmap_ad(8)
rid idmap config rid idmap_rid(8)
autorid idmap config autorid idmap_autorid(8)

Domain Administrator アカウントをローカルの root ユーザーにマッピングする

Sambaではドメインアカウントをローカルアカウントにマッピングすることができます。 この機能を使用して、クライアントで操作を要求したアカウントとは異なるユーザーとしてドメインメンバーのファイルシステムでファイル操作を実行します。

This message box is using an invalid "type=note" parameter and needs fixing.

ドメイン管理者をローカルの root アカウントにマッピングするには、次の手順を実行します。

  • smb.conf ファイルの [global] セクションに次のパラメータを追加します。
username map = /usr/local/samba/etc/user.map
  • 以下の内容で/usr/local/samba/etc/user.mapファイルを作成します。:
!root = SAMDOM\Administrator
This message box is using an invalid "type=important" parameter and needs fixing.

詳細は、smb.conf(5のmanページのusername mapパラメータをご覧ください。

ドメインに参加

  • ホストをActive Directory(AD)に参加させるには次のように入力:
# net ads join -U administrator
Enter administrator's password: Passw0rd
Using short domain name -- SAMDOM
Joined 'M1' to dns domain 'samdom.example.com'
  • ホストをNT4ドメインに参加させるには次のように入力:
# net rpc join -U administrator
Enter administrator's password: Passw0rd
Joined domain SAMDOM.

ドメインへの参加に問題がある場合は、設定を確認してください。 さらなるヘルプについては、 Sambaドメインメンバのトラブルシューティングを参照してください。

ネームサービススイッチの設定

ネームサービススイッチ(NSS)ライブラリを有効にして、ドメインユーザーとグループがローカルシステムで使用できるようにするには;

  • winbindのエントリを/etc/nsswitch.confファイルの以下のデータベースに追加します:
passwd: files winbind
group:  files winbind
  • それぞれ両方のデータベースの最初のソースは、filesエントリのままにしておいてください。これにより、NSSはWinbindサービスに問い合わせをする前に、/etc/passwd/etc/groupファイルからドメインユーザーおよび、ドメイングループを検索できます。
  • winbindのエントリをshadowデータベースに追加してはいけません。これによって、wbinfoユーティリティーが失敗する可能性があります。

Starting the Services

Unixドメインメンバが完全に機能させるために、次のサービスを開始してください:

  • smbd サービス
  • nmbd サービス
  • winbindd サービス


This message box is using an invalid "type=note" parameter and needs fixing.


This message box is using an invalid "type=note" parameter and needs fixing.


Sambaは、System V initスクリプト、systemdupstart、あるいはその他initサービス用のサービスファイルを提供していません。

  • パッケージを使用してSambaをインストールした場合は、Sambaを起動するためにパッケージによって提供されるスクリプトまたはサービス設定ファイルを使用してください。
  • Sambaをビルドした場合は、サービスを開始するためのスクリプトまたは設定の作成方法について、ディストリビューションのドキュメントを参照してください。

Winbindへの接続を確認

Winbindd Ping を送信する

WinbinddサービスがActive Directory(AD)ドメインコントローラ(DC)またはプライマリドメインコントローラ(PDC)に接続できるかどうかを確認するには、次のように入力します。

# wbinfo --ping-dc
checking the NETLOGON for domain[SAMDOM] dc connection to "DC.SAMDOM.EXAMPLE.COM" succeeded

前のコマンドが失敗した場合は、次の点を確認してください。

  • winbinddサービスが実行されていること。
  • smb.confファイルは正しく設定されていること。


オペレーティングシステムのコマンドでドメインアカウントとグループを使用する

ドメインユーザーとグループを調べる

libnss_winbindライブラリを使用すると、ドメインのユーザーとグループを検索できます。 例えば:

  • ドメインユーザーSAMDOM\demo01を検索するには:
# getent passwd SAMDOM\\demo01
SAMDOM\demo01:*:10000:10000:demo01:/home/demo01:/bin/bash
  • Domain Usersのグループを検索するには:
# getent group "SAMDOM\\Domain Users"
SAMDOM\domain users:x:10000:


ドメインユーザーとグループにファイルのアクセス許可を割り当てる

ネームサービススイッチ(NSS)ライブラリを使用すると、コマンドでドメインユーザーアカウントとグループを使用できます。たとえば、ファイルの所有者をdemo01ドメインユーザーに、グループをDomain Usersドメイングループに設定するには、次のように入力します。

# chown "SAMDOM\\demo01:SAMDOM\\domain users" file.txt

ドメインメンバーに追加サのービスを設定する

Sambaドメインメンバーに、追加の設定ができます。

トラブルシューティング

詳細については、 Sambaドメインメンバのトラブルシューティングを参照してください。