<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://www.rough-and-cheap.jp/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Meisina04</id>
	<title>雑廉堂Wiki - 利用者の投稿記録 [ja]</title>
	<link rel="self" type="application/atom+xml" href="https://www.rough-and-cheap.jp/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Meisina04"/>
	<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E7%89%B9%E5%88%A5:%E6%8A%95%E7%A8%BF%E8%A8%98%E9%8C%B2/Meisina04"/>
	<updated>2026-05-17T13:52:44Z</updated>
	<subtitle>利用者の投稿記録</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10080</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10080"/>
		<updated>2020-07-17T02:03:41Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Setting ACLs on the Shared Directories */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{imbox&lt;br /&gt;
| type  = speedy&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= smb.conf ファイルで基本の認証されたアクセスを作成する =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
Samba スタンドアローンサーバーの最小構成を以下に示します:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt; でワークグループ名を設定することができます。&#039;xxxxxxxx&#039; は必須です。もしパラメータが設定されていない場合、規定のワークグループ名として &#039;WORKGROUP&#039; が使用されます。&lt;br /&gt;
* 最小構成ではログのパラメータは必須ではありません。しかしながら、問題が発生した場合にログファイルを設定し、ログレベルを上げると役立ちます。&lt;br /&gt;
* 上記は最小限の smb.conf ファイルですが、Unix と Samba の同期が維持されているかを確認することができる &#039;unix password sync = yes&#039; のような他のパラメータを追加することができます。詳細は &#039;man smb.conf&#039; を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ローカルユーザーアカウントの作成 =&lt;br /&gt;
&lt;br /&gt;
スタンドアローンホストで認証を提供するには、オペレーティングシステムでローカルに加えて、Samba データベースにアカウントを作成する必要があります。Samba は &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; バックエンドを使用して、&amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; ファイルにデータベースを保存します。任意で、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; 内で &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; パラメータを使用して別の場所を設定することができます。詳細は &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; のマニュアルページを参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムに &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを作成&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:もし、このホストでユーザーのホームディレクトリが必要な場合は、&amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt;パラメータを省略してください。Samba がアクセスするのには、アカウントに有効なシェルは必要ありません。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムで &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを有効にする。&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: アカウントを有効にするには、ローカルパスワードを設定することは必須です。Samba はローカルで無効にされたアカウントのアクセスを拒否します。もし、有効なシェルを使わずにアカウントを作成した場合、このパスワードを使用したログインは不可能になります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウント Samba データベースに追加します&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:この手順で割り当てられるパスワードは、ドメインにログインするためにユーザーが使用するパスワードです。&lt;br /&gt;
&lt;br /&gt;
= ローカルグループの管理 =&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; グループを作成するには:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントをグループに追加するには:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
= 共有ディレクトリの作成 =&lt;br /&gt;
&lt;br /&gt;
共有ディレクトリを作成:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
= 共有ディレクトリに ACL を設定する =&lt;br /&gt;
&lt;br /&gt;
以下の POSIX パーミッションを設定します:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
これは、 &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; グループのメンバーに、両方のディレクトリの書込みアクセスを構成します。他のユーザーは、&amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; に読込アクセス権を持っており、&amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; ディレクトリにはなんの権限も持っていません。ディレクトリにセットされているモードの最初のビット - (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) で表されている - SGID ビットは、ファイル作成時に、ユーザーのプライマリグループでセットする代わりに親ディレクトリのグループを引き継いでセットします。&lt;br /&gt;
&lt;br /&gt;
詳細な情報については、[[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]] を参照してください。&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10079</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10079"/>
		<updated>2020-07-17T01:41:10Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Creating the Shared Directories */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{imbox&lt;br /&gt;
| type  = speedy&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= smb.conf ファイルで基本の認証されたアクセスを作成する =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
Samba スタンドアローンサーバーの最小構成を以下に示します:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt; でワークグループ名を設定することができます。&#039;xxxxxxxx&#039; は必須です。もしパラメータが設定されていない場合、規定のワークグループ名として &#039;WORKGROUP&#039; が使用されます。&lt;br /&gt;
* 最小構成ではログのパラメータは必須ではありません。しかしながら、問題が発生した場合にログファイルを設定し、ログレベルを上げると役立ちます。&lt;br /&gt;
* 上記は最小限の smb.conf ファイルですが、Unix と Samba の同期が維持されているかを確認することができる &#039;unix password sync = yes&#039; のような他のパラメータを追加することができます。詳細は &#039;man smb.conf&#039; を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ローカルユーザーアカウントの作成 =&lt;br /&gt;
&lt;br /&gt;
スタンドアローンホストで認証を提供するには、オペレーティングシステムでローカルに加えて、Samba データベースにアカウントを作成する必要があります。Samba は &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; バックエンドを使用して、&amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; ファイルにデータベースを保存します。任意で、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; 内で &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; パラメータを使用して別の場所を設定することができます。詳細は &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; のマニュアルページを参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムに &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを作成&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:もし、このホストでユーザーのホームディレクトリが必要な場合は、&amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt;パラメータを省略してください。Samba がアクセスするのには、アカウントに有効なシェルは必要ありません。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムで &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを有効にする。&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: アカウントを有効にするには、ローカルパスワードを設定することは必須です。Samba はローカルで無効にされたアカウントのアクセスを拒否します。もし、有効なシェルを使わずにアカウントを作成した場合、このパスワードを使用したログインは不可能になります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウント Samba データベースに追加します&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:この手順で割り当てられるパスワードは、ドメインにログインするためにユーザーが使用するパスワードです。&lt;br /&gt;
&lt;br /&gt;
= ローカルグループの管理 =&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; グループを作成するには:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントをグループに追加するには:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
= 共有ディレクトリの作成 =&lt;br /&gt;
&lt;br /&gt;
共有ディレクトリを作成:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10078</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10078"/>
		<updated>2020-07-17T01:40:32Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Local Group Management */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{imbox&lt;br /&gt;
| type  = speedy&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= smb.conf ファイルで基本の認証されたアクセスを作成する =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
Samba スタンドアローンサーバーの最小構成を以下に示します:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt; でワークグループ名を設定することができます。&#039;xxxxxxxx&#039; は必須です。もしパラメータが設定されていない場合、規定のワークグループ名として &#039;WORKGROUP&#039; が使用されます。&lt;br /&gt;
* 最小構成ではログのパラメータは必須ではありません。しかしながら、問題が発生した場合にログファイルを設定し、ログレベルを上げると役立ちます。&lt;br /&gt;
* 上記は最小限の smb.conf ファイルですが、Unix と Samba の同期が維持されているかを確認することができる &#039;unix password sync = yes&#039; のような他のパラメータを追加することができます。詳細は &#039;man smb.conf&#039; を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ローカルユーザーアカウントの作成 =&lt;br /&gt;
&lt;br /&gt;
スタンドアローンホストで認証を提供するには、オペレーティングシステムでローカルに加えて、Samba データベースにアカウントを作成する必要があります。Samba は &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; バックエンドを使用して、&amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; ファイルにデータベースを保存します。任意で、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; 内で &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; パラメータを使用して別の場所を設定することができます。詳細は &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; のマニュアルページを参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムに &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを作成&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:もし、このホストでユーザーのホームディレクトリが必要な場合は、&amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt;パラメータを省略してください。Samba がアクセスするのには、アカウントに有効なシェルは必要ありません。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムで &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを有効にする。&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: アカウントを有効にするには、ローカルパスワードを設定することは必須です。Samba はローカルで無効にされたアカウントのアクセスを拒否します。もし、有効なシェルを使わずにアカウントを作成した場合、このパスワードを使用したログインは不可能になります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウント Samba データベースに追加します&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:この手順で割り当てられるパスワードは、ドメインにログインするためにユーザーが使用するパスワードです。&lt;br /&gt;
&lt;br /&gt;
= ローカルグループの管理 =&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; グループを作成するには:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントをグループに追加するには:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10077</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10077"/>
		<updated>2020-07-17T01:39:09Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* ローカルユーザーアカウントの作成 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{imbox&lt;br /&gt;
| type  = speedy&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= smb.conf ファイルで基本の認証されたアクセスを作成する =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
Samba スタンドアローンサーバーの最小構成を以下に示します:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt; でワークグループ名を設定することができます。&#039;xxxxxxxx&#039; は必須です。もしパラメータが設定されていない場合、規定のワークグループ名として &#039;WORKGROUP&#039; が使用されます。&lt;br /&gt;
* 最小構成ではログのパラメータは必須ではありません。しかしながら、問題が発生した場合にログファイルを設定し、ログレベルを上げると役立ちます。&lt;br /&gt;
* 上記は最小限の smb.conf ファイルですが、Unix と Samba の同期が維持されているかを確認することができる &#039;unix password sync = yes&#039; のような他のパラメータを追加することができます。詳細は &#039;man smb.conf&#039; を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ローカルユーザーアカウントの作成 =&lt;br /&gt;
&lt;br /&gt;
スタンドアローンホストで認証を提供するには、オペレーティングシステムでローカルに加えて、Samba データベースにアカウントを作成する必要があります。Samba は &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; バックエンドを使用して、&amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; ファイルにデータベースを保存します。任意で、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; 内で &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; パラメータを使用して別の場所を設定することができます。詳細は &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; のマニュアルページを参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムに &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを作成&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:もし、このホストでユーザーのホームディレクトリが必要な場合は、&amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt;パラメータを省略してください。Samba がアクセスするのには、アカウントに有効なシェルは必要ありません。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムで &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを有効にする。&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: アカウントを有効にするには、ローカルパスワードを設定することは必須です。Samba はローカルで無効にされたアカウントのアクセスを拒否します。もし、有効なシェルを使わずにアカウントを作成した場合、このパスワードを使用したログインは不可能になります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウント Samba データベースに追加します&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:この手順で割り当てられるパスワードは、ドメインにログインするためにユーザーが使用するパスワードです。&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10076</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10076"/>
		<updated>2020-07-17T00:53:13Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{imbox&lt;br /&gt;
| type  = speedy&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= smb.conf ファイルで基本の認証されたアクセスを作成する =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
Samba スタンドアローンサーバーの最小構成を以下に示します:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt; でワークグループ名を設定することができます。&#039;xxxxxxxx&#039; は必須です。もしパラメータが設定されていない場合、規定のワークグループ名として &#039;WORKGROUP&#039; が使用されます。&lt;br /&gt;
* 最小構成ではログのパラメータは必須ではありません。しかしながら、問題が発生した場合にログファイルを設定し、ログレベルを上げると役立ちます。&lt;br /&gt;
* 上記は最小限の smb.conf ファイルですが、Unix と Samba の同期が維持されているかを確認することができる &#039;unix password sync = yes&#039; のような他のパラメータを追加することができます。詳細は &#039;man smb.conf&#039; を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ローカルユーザーアカウントの作成 =&lt;br /&gt;
&lt;br /&gt;
スタンドアローンホストで認証を提供するには、オペレーティングシステムでローカルに加えて、Samba データベースにアカウントを作成する必要があります。Samba は &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; バックエンドを使用して、&amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; ファイルにデータベースを保存します。任意で、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; 内で &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; パラメータを使用して別の場所を設定することができます。詳細は &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; のマニュアルページを参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ローカルシステムに &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; アカウントを作成&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:Omit the &amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt; parameter if the user requires a home directory on this host. For Samba access, the account does not require a valid shell.&lt;br /&gt;
&lt;br /&gt;
* To enable the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: Setting a local password is required to enable the account. Samba denies access if the account is disabled locally. Local log ins using this password are not possible if the account was created without a valid shell.&lt;br /&gt;
&lt;br /&gt;
* Add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the Samba database:&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:The password assigned in these steps is the one used by the user to log in to the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10075</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10075"/>
		<updated>2020-07-17T00:22:16Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{imbox&lt;br /&gt;
| type  = speedy&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic authenticated access smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You can set a workgroup name with &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt;, where &#039;xxxxxxxx&#039; is the required name. If the parameter isn&#039;t set, the default workgroup name &#039;WORKGROUP&#039; will be used.&lt;br /&gt;
* The log parameters are not necessary for a minimal setup. However they are useful to set the log file and increasing the log level in case of problems.&lt;br /&gt;
* Whilst these are only minimal smb.conf files, you can add other parameters, such as &#039;unix password sync = yes&#039; to ensure the Unix &amp;amp; Samba passwords are kept in sync. See &#039;man smb.conf&#039; for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Local User Account =&lt;br /&gt;
&lt;br /&gt;
To provide authentication on a standalone host, you have to create the accounts locally on the operating system and additionally in the Samba database. By default, Samba uses the &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; back end and stores the database in the &amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; file. Optionally set a different location in the &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; file using the &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; parameter. See the &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; man page for details.&lt;br /&gt;
&lt;br /&gt;
* Create a &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:Omit the &amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt; parameter if the user requires a home directory on this host. For Samba access, the account does not require a valid shell.&lt;br /&gt;
&lt;br /&gt;
* To enable the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: Setting a local password is required to enable the account. Samba denies access if the account is disabled locally. Local log ins using this password are not possible if the account was created without a valid shell.&lt;br /&gt;
&lt;br /&gt;
* Add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the Samba database:&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:The password assigned in these steps is the one used by the user to log in to the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Setting_up_Samba_as_a_Standalone_Server&amp;diff=10074</id>
		<title>Setting up Samba as a Standalone Server</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Setting_up_Samba_as_a_Standalone_Server&amp;diff=10074"/>
		<updated>2020-07-17T00:18:41Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: Meisina04 がページ「Setting up Samba as a Standalone Server」を「Samba をスタンドアローンサーバーとして構成」に移動しました: 日本語化&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#転送 [[Samba をスタンドアローンサーバーとして構成]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10073</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10073"/>
		<updated>2020-07-17T00:18:40Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: Meisina04 がページ「Setting up Samba as a Standalone Server」を「Samba をスタンドアローンサーバーとして構成」に移動しました: 日本語化&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = exclamation&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic authenticated access smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You can set a workgroup name with &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt;, where &#039;xxxxxxxx&#039; is the required name. If the parameter isn&#039;t set, the default workgroup name &#039;WORKGROUP&#039; will be used.&lt;br /&gt;
* The log parameters are not necessary for a minimal setup. However they are useful to set the log file and increasing the log level in case of problems.&lt;br /&gt;
* Whilst these are only minimal smb.conf files, you can add other parameters, such as &#039;unix password sync = yes&#039; to ensure the Unix &amp;amp; Samba passwords are kept in sync. See &#039;man smb.conf&#039; for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Local User Account =&lt;br /&gt;
&lt;br /&gt;
To provide authentication on a standalone host, you have to create the accounts locally on the operating system and additionally in the Samba database. By default, Samba uses the &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; back end and stores the database in the &amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; file. Optionally set a different location in the &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; file using the &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; parameter. See the &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; man page for details.&lt;br /&gt;
&lt;br /&gt;
* Create a &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:Omit the &amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt; parameter if the user requires a home directory on this host. For Samba access, the account does not require a valid shell.&lt;br /&gt;
&lt;br /&gt;
* To enable the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: Setting a local password is required to enable the account. Samba denies access if the account is disabled locally. Local log ins using this password are not possible if the account was created without a valid shell.&lt;br /&gt;
&lt;br /&gt;
* Add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the Samba database:&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:The password assigned in these steps is the one used by the user to log in to the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10072</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10072"/>
		<updated>2020-07-17T00:17:46Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = exclamation&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic authenticated access smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You can set a workgroup name with &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt;, where &#039;xxxxxxxx&#039; is the required name. If the parameter isn&#039;t set, the default workgroup name &#039;WORKGROUP&#039; will be used.&lt;br /&gt;
* The log parameters are not necessary for a minimal setup. However they are useful to set the log file and increasing the log level in case of problems.&lt;br /&gt;
* Whilst these are only minimal smb.conf files, you can add other parameters, such as &#039;unix password sync = yes&#039; to ensure the Unix &amp;amp; Samba passwords are kept in sync. See &#039;man smb.conf&#039; for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Local User Account =&lt;br /&gt;
&lt;br /&gt;
To provide authentication on a standalone host, you have to create the accounts locally on the operating system and additionally in the Samba database. By default, Samba uses the &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; back end and stores the database in the &amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; file. Optionally set a different location in the &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; file using the &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; parameter. See the &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; man page for details.&lt;br /&gt;
&lt;br /&gt;
* Create a &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:Omit the &amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt; parameter if the user requires a home directory on this host. For Samba access, the account does not require a valid shell.&lt;br /&gt;
&lt;br /&gt;
* To enable the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: Setting a local password is required to enable the account. Samba denies access if the account is disabled locally. Local log ins using this password are not possible if the account was created without a valid shell.&lt;br /&gt;
&lt;br /&gt;
* Add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the Samba database:&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:The password assigned in these steps is the one used by the user to log in to the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=SambaWiki%E7%BF%BB%E8%A8%B3&amp;diff=10071</id>
		<title>SambaWiki翻訳</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=SambaWiki%E7%BF%BB%E8%A8%B3&amp;diff=10071"/>
		<updated>2020-07-17T00:15:42Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://wiki.samba.org/ Samba Wiki]のドキュメントの一部を翻訳したものです。&lt;br /&gt;
&lt;br /&gt;
※ あくまで雑廉堂個人の覚書用です。&lt;br /&gt;
&lt;br /&gt;
* [[Sambaのインストール]]&lt;br /&gt;
:* [[ディストリビューション固有のパッケージインストール]]&lt;br /&gt;
* [[Sambaの更新]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[ドメインコントロール]]&lt;br /&gt;
:* [[Active Directory  Domain Controller]]&lt;br /&gt;
::* [[Active Directoryの名前付けに関するよくある質問]]&lt;br /&gt;
::* [[SambaをActive Directoryドメインコントローラとして設定する]]&lt;br /&gt;
::* [[Samba DCを既存のActive Directoryに参加させる]]&lt;br /&gt;
:::* [[DC DNSレコードの確認と作成]]&lt;br /&gt;
::* [[Samba AD DNSバックエンド]]&lt;br /&gt;
:::* [[Samba内部DNSバックエンド]]&lt;br /&gt;
:::* [[BIND9 DLZ DNSバックエンド]]&lt;br /&gt;
::::* [[BIND DNSサーバーの設定]]&lt;br /&gt;
::::* [[BIND9 DLZ AppArmorとSELinux統合]]&lt;br /&gt;
:::* [[動的DNS更新のテスト]]&lt;br /&gt;
:::* [[BIND9 FLATFILE DNSバックエンド]]&lt;br /&gt;
::* [[Samba AD DC上でのWinbinddの設定]]&lt;br /&gt;
::* [[時刻の同期]]&lt;br /&gt;
:::* [[時刻の同期-SELinuxでのラベル付とポリシー]]&lt;br /&gt;
::* [[ディレクトリ複製の状態の確認]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[ドメインメンバーシップ]]&lt;br /&gt;
:* [[Windowsクライアント、サーバーをドメインに参加させる]]&lt;br /&gt;
::* [[WindowsでのDNS設定]]&lt;br /&gt;
:* [[Linux、あるいはUnixホストをドメインに参加せせる]]&lt;br /&gt;
::* [[LinuxとUnixでのDNS設定]]&lt;br /&gt;
::* &amp;lt;del&amp;gt;[[SambaをActive Directoryドメインメンバとして構成する]]&amp;lt;/del&amp;gt;&lt;br /&gt;
::* [[Sambaをドメインメンバーとして設定]]&lt;br /&gt;
:::* [[ID Mappingのバックエンド]]&lt;br /&gt;
::::* [[idmap config ad]] (RFC2307)&lt;br /&gt;
::::* [[idmap config rid]]&lt;br /&gt;
::::* [[idmap config autorid]]&lt;br /&gt;
::::* [[Local accounts]]&lt;br /&gt;
:::* [[PAMを使用したドメインユーザーの認証]]&lt;br /&gt;
:::* [[PAM Offline Authentication]]&lt;br /&gt;
::* [[Samba Domain Member Port Usage]]&lt;br /&gt;
:* [[Joining a Mac OS X Client to a Domain]]&lt;br /&gt;
::* [[Mac OS X DNS Configuration]]&lt;br /&gt;
:* [[Configuring FreeDOS to Access a Samba Share]]&lt;br /&gt;
:* [[Sambaドメインメンバのトラブルシューティング]]&lt;br /&gt;
&lt;br /&gt;
* [[Standalone Server]]&lt;br /&gt;
:* [[Setting up Samba as a Standalone Server]]&lt;br /&gt;
&lt;br /&gt;
* [[上級者向けの設定]]&lt;br /&gt;
:* [[DNSの管理]]&lt;br /&gt;
::* [[Samba AD DCのDNSバックエンドの変更]]&lt;br /&gt;
::* [[DNSの管理]]&lt;br /&gt;
::* [[DNSによる名前解決のテスト]]&lt;br /&gt;
::* [[DNSトラブルシューティング]]&lt;br /&gt;
:::* [[dns tkey negotiategss tkey is un acceptable]]&lt;br /&gt;
:* [[ADにRFC2307を設定する]]&lt;br /&gt;
:* [[プリントサーバーサポート]]&lt;br /&gt;
::* [[Sambaをプリントサーバとして設定する]]&lt;br /&gt;
::* [[Windowsクライアント用の自動プリンタドライバのダウンロードをセットアップする]]&lt;br /&gt;
:* [[Active Directoryサイト]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[レプリケーション]]&lt;br /&gt;
:* [[分散ファイルシステム(DFS)]]&lt;br /&gt;
::* [[Sysvolレプリケーション（DFS-R）]]&lt;br /&gt;
:::* [[RsyncベースのSysvolレプリケーションの回避策]](Samba DCs Only)&lt;br /&gt;
:::* [[双方向のRsync/UnisonベースのSysvolレプリケーション回避策]](Samba DCs Only)&lt;br /&gt;
:::* [[双方向のRsync/osyncベースのSysvolレプリケーション回避策]](Samba DCs Only)&lt;br /&gt;
:::* [[RobocopyベースのSysvolレプリケーション回避策]](Samba DCs -&amp;gt; Windows DCs)&lt;br /&gt;
:* [[ディレクトリレプリケーションサービス(DRS)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[一般的な管理タスク]]&lt;br /&gt;
:* [[Windowsリモートサーバー管理ツール（RSAT)]]&lt;br /&gt;
::* [[RSATのインストール]]&lt;br /&gt;
:* [[Sambaのリモートとローカルの管理]]&lt;br /&gt;
::* [[ユーザーとグループの管理]]&lt;br /&gt;
:::* [[ADUCを使用したADにおけるUnix属性の管理]]&lt;br /&gt;
:* [[バックアップとリストア]]&lt;br /&gt;
::* [[Samba AD DCのバックアップとリストア]]&lt;br /&gt;
:* [[Sambaファイルサーバ]]&lt;br /&gt;
::* [[Windows ACLs を利用して共有を設定する]]&lt;br /&gt;
::* [[POSIX ACLs を利用して共有を設定する]]&lt;br /&gt;
::* [[特別なファイル共有]]&lt;br /&gt;
:::* [[ユーザーホームフォルダ]]&lt;br /&gt;
:::* [[Windowsの移動ユーザープロファイル]]&lt;br /&gt;
::::* [[Windowsのプロファイルフォルダリダイレクションの設定]]&lt;br /&gt;
:::* [[認証のいらない共有の設定]]&lt;br /&gt;
:* [[Samba_AD_DCでLDAP_over_SSL(LDAPS)を構成する]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10070</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10070"/>
		<updated>2020-02-20T03:23:24Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* 基本的なゲスト専用の smb.conf ファイルの作成 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = warning&lt;br /&gt;
| text = この例は、認証なしにアクセス出来る共有の定義です。ゲスト共有はセキュリティ上問題になり得ます。例えば、家や、学校や職場のネットワークといった異なったネットワークに接続されるノートパソコンです。ゲスト共有は慎重に使用し、認証されたユーザーでは決してゲスト共有を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic authenticated access smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You can set a workgroup name with &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt;, where &#039;xxxxxxxx&#039; is the required name. If the parameter isn&#039;t set, the default workgroup name &#039;WORKGROUP&#039; will be used.&lt;br /&gt;
* The log parameters are not necessary for a minimal setup. However they are useful to set the log file and increasing the log level in case of problems.&lt;br /&gt;
* Whilst these are only minimal smb.conf files, you can add other parameters, such as &#039;unix password sync = yes&#039; to ensure the Unix &amp;amp; Samba passwords are kept in sync. See &#039;man smb.conf&#039; for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Local User Account =&lt;br /&gt;
&lt;br /&gt;
To provide authentication on a standalone host, you have to create the accounts locally on the operating system and additionally in the Samba database. By default, Samba uses the &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; back end and stores the database in the &amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; file. Optionally set a different location in the &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; file using the &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; parameter. See the &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; man page for details.&lt;br /&gt;
&lt;br /&gt;
* Create a &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:Omit the &amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt; parameter if the user requires a home directory on this host. For Samba access, the account does not require a valid shell.&lt;br /&gt;
&lt;br /&gt;
* To enable the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: Setting a local password is required to enable the account. Samba denies access if the account is disabled locally. Local log ins using this password are not possible if the account was created without a valid shell.&lt;br /&gt;
&lt;br /&gt;
* Add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the Samba database:&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:The password assigned in these steps is the one used by the user to log in to the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10069</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10069"/>
		<updated>2020-02-20T03:06:36Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Creating a Basic guest only smb.conf File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= 基本的なゲスト専用の smb.conf ファイルの作成 =&lt;br /&gt;
&lt;br /&gt;
以下は、ゲストアクセスのみを許可する Samba スタンドアローンサーバーの最小構成です。&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = warning&lt;br /&gt;
| text = This example defines a share that is accessible without authentication. Guest shares can be a security problem. For example on a laptop that is connected to different networks, such as home, school, and work networks. Use guest shares with care and never use a guest share with authenticated users.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic authenticated access smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You can set a workgroup name with &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt;, where &#039;xxxxxxxx&#039; is the required name. If the parameter isn&#039;t set, the default workgroup name &#039;WORKGROUP&#039; will be used.&lt;br /&gt;
* The log parameters are not necessary for a minimal setup. However they are useful to set the log file and increasing the log level in case of problems.&lt;br /&gt;
* Whilst these are only minimal smb.conf files, you can add other parameters, such as &#039;unix password sync = yes&#039; to ensure the Unix &amp;amp; Samba passwords are kept in sync. See &#039;man smb.conf&#039; for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Local User Account =&lt;br /&gt;
&lt;br /&gt;
To provide authentication on a standalone host, you have to create the accounts locally on the operating system and additionally in the Samba database. By default, Samba uses the &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; back end and stores the database in the &amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; file. Optionally set a different location in the &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; file using the &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; parameter. See the &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; man page for details.&lt;br /&gt;
&lt;br /&gt;
* Create a &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:Omit the &amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt; parameter if the user requires a home directory on this host. For Samba access, the account does not require a valid shell.&lt;br /&gt;
&lt;br /&gt;
* To enable the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: Setting a local password is required to enable the account. Samba denies access if the account is disabled locally. Local log ins using this password are not possible if the account was created without a valid shell.&lt;br /&gt;
&lt;br /&gt;
* Add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the Samba database:&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:The password assigned in these steps is the one used by the user to log in to the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10068</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10068"/>
		<updated>2020-02-20T03:01:21Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
ホームネットワークのような小規模なネットーワークや、ドメインの一部ではないホスト上のフォルダ等を共有するために [[Active Directory]] や [[NT4 Domain]] を設定したくない場合がよくあります。&lt;br /&gt;
&lt;br /&gt;
下に続く文書では Samba スタンドアローンサーバー のセットアップ方法について説明します。&lt;br /&gt;
&lt;br /&gt;
* 匿名でアクセス可能な共有 (ゲストアクセス)&lt;br /&gt;
* Samba ホストのユーザーデータベースに対する認証を必要とする共有&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic guest only smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server that only allows guest access:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = warning&lt;br /&gt;
| text = This example defines a share that is accessible without authentication. Guest shares can be a security problem. For example on a laptop that is connected to different networks, such as home, school, and work networks. Use guest shares with care and never use a guest share with authenticated users.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic authenticated access smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You can set a workgroup name with &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt;, where &#039;xxxxxxxx&#039; is the required name. If the parameter isn&#039;t set, the default workgroup name &#039;WORKGROUP&#039; will be used.&lt;br /&gt;
* The log parameters are not necessary for a minimal setup. However they are useful to set the log file and increasing the log level in case of problems.&lt;br /&gt;
* Whilst these are only minimal smb.conf files, you can add other parameters, such as &#039;unix password sync = yes&#039; to ensure the Unix &amp;amp; Samba passwords are kept in sync. See &#039;man smb.conf&#039; for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Local User Account =&lt;br /&gt;
&lt;br /&gt;
To provide authentication on a standalone host, you have to create the accounts locally on the operating system and additionally in the Samba database. By default, Samba uses the &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; back end and stores the database in the &amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; file. Optionally set a different location in the &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; file using the &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; parameter. See the &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; man page for details.&lt;br /&gt;
&lt;br /&gt;
* Create a &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:Omit the &amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt; parameter if the user requires a home directory on this host. For Samba access, the account does not require a valid shell.&lt;br /&gt;
&lt;br /&gt;
* To enable the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: Setting a local password is required to enable the account. Samba denies access if the account is disabled locally. Local log ins using this password are not possible if the account was created without a valid shell.&lt;br /&gt;
&lt;br /&gt;
* Add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the Samba database:&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:The password assigned in these steps is the one used by the user to log in to the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10067</id>
		<title>Samba をスタンドアローンサーバーとして構成</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_%E3%82%92%E3%82%B9%E3%82%BF%E3%83%B3%E3%83%89%E3%82%A2%E3%83%AD%E3%83%BC%E3%83%B3%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E6%A7%8B%E6%88%90&amp;diff=10067"/>
		<updated>2020-02-20T02:51:14Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: ページの作成:「= Introduction =  In small networks, such as a home network, or to share folders on a host that is not part of a domain, you often do not want to set up an Active_Direc…」&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
In small networks, such as a home network, or to share folders on a host that is not part of a domain, you often do not want to set up an [[Active_Directory_Domain_Controller|Active Directory]] or [[NT4_Domains|NT4 domain]].&lt;br /&gt;
&lt;br /&gt;
The following documentation describes how to set up a Samba standalone server providing:&lt;br /&gt;
* a share that is accessible anonymously (guest access).&lt;br /&gt;
* a share that requires authentication against a local user database on the Samba host.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic guest only smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server that only allows guest access:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         map to guest = Bad User&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [guest]&lt;br /&gt;
         # This share allows anonymous (guest) access&lt;br /&gt;
         # without authentication!&lt;br /&gt;
         path = /srv/samba/guest/&lt;br /&gt;
         read only = no&lt;br /&gt;
         guest ok = yes&lt;br /&gt;
         guest only = yes&lt;br /&gt;
 &lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = warning&lt;br /&gt;
| text = This example defines a share that is accessible without authentication. Guest shares can be a security problem. For example on a laptop that is connected to different networks, such as home, school, and work networks. Use guest shares with care and never use a guest share with authenticated users.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Basic authenticated access smb.conf File =&lt;br /&gt;
&lt;br /&gt;
The following is a minimal configuration for a Samba standalone server:&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
         log file = /var/log/samba/%m&lt;br /&gt;
         log level = 1&lt;br /&gt;
 &lt;br /&gt;
 [demo]&lt;br /&gt;
         # This share requires authentication to access&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You can set a workgroup name with &amp;lt;code&amp;gt;workgroup = xxxxxxxx&amp;lt;/code&amp;gt;, where &#039;xxxxxxxx&#039; is the required name. If the parameter isn&#039;t set, the default workgroup name &#039;WORKGROUP&#039; will be used.&lt;br /&gt;
* The log parameters are not necessary for a minimal setup. However they are useful to set the log file and increasing the log level in case of problems.&lt;br /&gt;
* Whilst these are only minimal smb.conf files, you can add other parameters, such as &#039;unix password sync = yes&#039; to ensure the Unix &amp;amp; Samba passwords are kept in sync. See &#039;man smb.conf&#039; for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating a Local User Account =&lt;br /&gt;
&lt;br /&gt;
To provide authentication on a standalone host, you have to create the accounts locally on the operating system and additionally in the Samba database. By default, Samba uses the &amp;lt;code&amp;gt;tdbsam&amp;lt;/code&amp;gt; back end and stores the database in the &amp;lt;code&amp;gt;/usr/local/samba/private/passdb.tdb&amp;lt;/code&amp;gt; file. Optionally set a different location in the &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; file using the &amp;lt;code&amp;gt;passdb backend&amp;lt;/code&amp;gt; parameter. See the &amp;lt;code&amp;gt;smb.conf 5&amp;lt;/code&amp;gt; man page for details.&lt;br /&gt;
&lt;br /&gt;
* Create a &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # useradd -M -s /sbin/nologin demoUser&lt;br /&gt;
&lt;br /&gt;
:Omit the &amp;lt;code&amp;gt;-M&amp;lt;/code&amp;gt; parameter if the user requires a home directory on this host. For Samba access, the account does not require a valid shell.&lt;br /&gt;
&lt;br /&gt;
* To enable the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account on the local system:&lt;br /&gt;
&lt;br /&gt;
 # passwd demoUser&lt;br /&gt;
 Enter new UNIX password: Passw0rd&lt;br /&gt;
 Retype new UNIX password: Passw0rd&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
: Setting a local password is required to enable the account. Samba denies access if the account is disabled locally. Local log ins using this password are not possible if the account was created without a valid shell.&lt;br /&gt;
&lt;br /&gt;
* Add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the Samba database:&lt;br /&gt;
&lt;br /&gt;
 # smbpasswd -a demoUser&lt;br /&gt;
 New SMB password: Passw0rd&lt;br /&gt;
 Retype new SMB password: Passw0rd&lt;br /&gt;
 Added user demoUser.&lt;br /&gt;
&lt;br /&gt;
:The password assigned in these steps is the one used by the user to log in to the domain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Local Group Management =&lt;br /&gt;
&lt;br /&gt;
* To create a &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group:&lt;br /&gt;
&lt;br /&gt;
 # groupadd demoGroup&lt;br /&gt;
&lt;br /&gt;
* To add the &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt; account to the group:&lt;br /&gt;
&lt;br /&gt;
 # usermod -aG demoGroup demoUser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
To create the shares directories:&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/guest/&lt;br /&gt;
 # mkdir -p /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Setting ACLs on the Shared Directories =&lt;br /&gt;
&lt;br /&gt;
Set the following POSIX permissions:&lt;br /&gt;
&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/guest/&lt;br /&gt;
 # chgrp -R demoGroup /srv/samba/demo/&lt;br /&gt;
 &lt;br /&gt;
 # chmod 2775 /srv/samba/guest/&lt;br /&gt;
 # chmod 2770 /srv/samba/demo/&lt;br /&gt;
&lt;br /&gt;
This configures write access to  members of the &amp;lt;code&amp;gt;demoGroup&amp;lt;/code&amp;gt; group in both directories. Other users have read access in the &amp;lt;code&amp;gt;/srv/samba/guest/&amp;lt;/code&amp;gt; and no access in the &amp;lt;code&amp;gt;/srv/samba/demo/&amp;lt;/code&amp;gt; directory. The SGID bit - represented by the first bit (&amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;) in the mode set on the directories - inherits the group of the parent directory instead setting it to the users primary group when new files are created.&lt;br /&gt;
&lt;br /&gt;
For further information, see [[Setting_up_a_Share_Using_POSIX_ACLs|Setting up a Share Using POSIX ACLs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Starting Samba =&lt;br /&gt;
&lt;br /&gt;
Start the &amp;lt;code&amp;gt;smbd&amp;lt;/code&amp;gt; daemon:&lt;br /&gt;
&lt;br /&gt;
 # smbd&lt;br /&gt;
&lt;br /&gt;
Samba does not include start scripts. See your distribution&#039;s documentation how further information how to automatically start a service at boot time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing the Share Access =&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as user &amp;lt;code&amp;gt;demoUser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U demoUser //SA/demo&lt;br /&gt;
 Enter demoUser&#039;s password: Passw0rd&lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 smb: \&amp;gt; ls&lt;br /&gt;
   .                                   D        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
   ..                                  D        0  Sun Jan  3 19:00:00 2016&lt;br /&gt;
   demo.txt                            A        0  Sun Jan  3 21:00:00 2016&lt;br /&gt;
 &lt;br /&gt;
 		9943040 blocks of size 1024. 7987416 blocks available&lt;br /&gt;
 smb: \&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
* Access the &amp;lt;code&amp;gt;demo&amp;lt;/code&amp;gt; share as guest. The access is denied:&lt;br /&gt;
&lt;br /&gt;
 # smbclient -U guest //SA/demo&lt;br /&gt;
 Enter guest&#039;s password: &lt;br /&gt;
 Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba x.y.z]&lt;br /&gt;
 tree connect failed: NT_STATUS_ACCESS_DENIED&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Advanced share settings =&lt;br /&gt;
&lt;br /&gt;
This section describes some advanced share configuration parameters. For further information about the used parameters, see the &amp;lt;code&amp;gt;smb.conf (5)&amp;lt;/code&amp;gt; man page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the &amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt; Parameters ==&lt;br /&gt;
&lt;br /&gt;
 [demo]&lt;br /&gt;
         path = /srv/samba/demo/&lt;br /&gt;
         read only = no&lt;br /&gt;
         force create mode = 0660&lt;br /&gt;
         force directory mode = 2770&lt;br /&gt;
         force user = demoUser&lt;br /&gt;
         force group = demoGroup&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force create mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force directory mode&amp;lt;/code&amp;gt; parameters force Samba to create new files and folders with the set permissions.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;force user&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;force group&amp;lt;/code&amp;gt; parameters map all connections to the specified user and group. Note that this can cause security problems if all users connecting to a share are mapped to a specific user account or group in the background.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User and Group-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_User_and_Group-based_Share_Access|Configuring User and Group-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Host-based Share Access ==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_a_Share_Using_POSIX_ACLs#Configuring_Host-based_share_access|Configuring Host-based Share Access]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Standalone Server]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Windows_ACLs_%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%A6%E5%85%B1%E6%9C%89%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B&amp;diff=10066</id>
		<title>Windows ACLs を利用して共有を設定する</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Windows_ACLs_%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%A6%E5%85%B1%E6%9C%89%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B&amp;diff=10066"/>
		<updated>2020-02-20T02:50:47Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* ホストの準備 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
拡張アクセス制御リスト（ACL）を使用すると、WindowsのACLおよびアプリケーションを使用して、共有、ファイル、およびディレクトリに対するアクセス許可を設定できます。Sambaは、以下で拡張ACLを使用して共有をサポートします。&lt;br /&gt;
* ドメインメンバ&lt;br /&gt;
* Active Directory (AD) ドメインコントローラ (DC)&lt;br /&gt;
* NT4 プライマリドメインコントローラ (PDC)&lt;br /&gt;
* NT4 バックアップドメインコントローラ (BDC)&lt;br /&gt;
* スタンドアローンホスト&lt;br /&gt;
&lt;br /&gt;
拡張ACLの代わりに、POSIX ACLを使用して共有を設定できます。 詳細については、 [[POSIX ACLs を利用して共有を設定する]]を見てください。.&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = notice&lt;br /&gt;
| text = SambaはDC上でのPOSIX ACLの使用をサポートしていません。 WindowsのACLを使用する必要があります。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= ホストの準備 =&lt;br /&gt;
&lt;br /&gt;
共有を作成する前にSambaを設定する必要があります。 どのタイプのSambaサーバーが必要かに応じて、以下を参照してください:&lt;br /&gt;
* [[SambaをActive Directoryドメインメンバとして構成する]]&lt;br /&gt;
* [[SambaをActive Directoryドメインコントローラとして設定する]]&lt;br /&gt;
* [[Setting_up_Samba_as_an_NT4_PDC_(Quick_Start)|Setting up Samba as an NT4 PDC (Quick Start)]]&lt;br /&gt;
* [[Setting_up_Samba_as_an_NT4_BDC|Setting up Samba as an NT4 BDC]]&lt;br /&gt;
* [[Setting_up_Samba_as_a_Standalone_Server|Samba をスタンドアローンサーバーとして構成する]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ファイルシステムのサポート ==&lt;br /&gt;
&lt;br /&gt;
共有が作成されるファイルシステムは、次のものをサポートしている必要があります。:&lt;br /&gt;
* ユーザーとシステムの &amp;lt;code&amp;gt;xattr&amp;lt;/code&amp;gt; 名前空間。&lt;br /&gt;
* 拡張されてアクセスコントロールリスト (ACL).&lt;br /&gt;
&lt;br /&gt;
For further details, see [[File_System_Support|File system support]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
拡張ACL（Access Control List）をサポートする共有を作成するには、&amp;lt;code&amp;gt; smbd &amp;lt;/code&amp;gt;サービスがACLサポートを有効にして構築されている必要があります。 Active Directory（AD）ドメインコントローラ（DC）として機能するSambaホストは、拡張ACLサポートにより常に有効になっています。&lt;br /&gt;
&lt;br /&gt;
SambaがACLサポート付きでビルドされたかどうかを確認するには、次のように入力:&lt;br /&gt;
&lt;br /&gt;
 # smbd -b | grep HAVE_LIBACL&lt;br /&gt;
    HAVE_LIBACL&lt;br /&gt;
&lt;br /&gt;
出力が表示されない場合&lt;br /&gt;
* Sambaは&amp;lt;code&amp;gt; --with-acl-support = no &amp;lt;/code&amp;gt;パラメータを使って構築されました。&lt;br /&gt;
* Sambaの&amp;lt;code&amp;gt; configure &amp;lt;/code&amp;gt;スクリプトは、ACLサポートに必要なライブラリを見つけることができませんでした。 詳細は[[Sambaをビルドするのに必要なパッケージ依存関係]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt;ファイルで拡張ACLサポートを有効にする&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
拡張アクセス制御リスト（ACL）を使って共有を設定するには、&amp;lt;code&amp;gt; smb.conf &amp;lt;/code&amp;gt;ファイルでサポートを有効にする必要があります。 拡張ACLサポートをグローバルに有効にするには、&amp;lt;code&amp;gt; smb.conf &amp;lt;/code&amp;gt;ファイルの&amp;lt;code&amp;gt; [global] &amp;lt;/code&amp;gt;セクションに次の設定を追加します。&lt;br /&gt;
&lt;br /&gt;
 vfs objects = acl_xattr&lt;br /&gt;
 map acl inherit = yes&lt;br /&gt;
 store dos attributes = yes&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| text = Samba Active Directory（AD）ドメインコントローラ（DC）では、拡張ACLサポートは自動的にグローバルに有効になります。 手動でサポートを有効にしないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
あるいは、特定の共有に対してのみ拡張ACLサポートを有効にするには、共有のセクションにパラメータを追加します。&lt;br /&gt;
パレメータの詳細については &amp;lt;code&amp;gt;smb.conf(5)&amp;lt;/code&amp;gt; のマニュアルページを見てください。&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;SeDiskOperatorPrivilege&amp;lt;/code&amp;gt; 権限の付与 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; SeDiskOperatorPrivilege &amp;lt;/code&amp;gt;権限を付与されたユーザーとグループのみが共有権限を設定できます。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; Domain Admins &amp;lt;/code&amp;gt;グループに権限を付与するには、次のように入力します。&lt;br /&gt;
&lt;br /&gt;
 # net rpc rights grant &amp;quot;SAMDOM\Domain Admins&amp;quot; SeDiskOperatorPrivilege -U &amp;quot;SAMDOM\administrator&amp;quot;&lt;br /&gt;
 Enter SAMDOM\administrator&#039;s password:&lt;br /&gt;
 Successfully granted rights.&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = notice&lt;br /&gt;
| text = 個々のアカウントではなくグループに特権を付与することをお勧めします。 これにより、グループメンバーシップを更新することで特権を追加したり取り消したりできます。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; SeDiskOperatorPrivilege &amp;lt;/code&amp;gt;特権が付与されているすべてのユーザーとグループを一覧表示するには、次のように入力します。&lt;br /&gt;
&lt;br /&gt;
 # net rpc rights list privileges SeDiskOperatorPrivilege -U &amp;quot;SAMDOM\administrator&amp;quot;&lt;br /&gt;
 Enter administrator&#039;s password:&lt;br /&gt;
 SeDiskOperatorPrivilege:&lt;br /&gt;
   BUILTIN\Administrators&lt;br /&gt;
   SAMDOM\Domain Admins&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| text = 共有を保持しているSambaサーバー上で&amp;lt;code&amp;gt; SeDiskOperatorPrivilege &amp;lt;/code&amp;gt;特権を付与する必要があります。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= 共有を追加 =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; Demo &amp;lt;/code&amp;gt;共有名を使用して&amp;lt;code&amp;gt;/srv/samba/Demo/&amp;lt;/code&amp;gt;ディレクトリを共有するには、次の手順を実行します。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt;ユーザーとして、ディレクトリを作成します。&lt;br /&gt;
&lt;br /&gt;
 # mkdir -p /srv/samba/Demo/&lt;br /&gt;
&lt;br /&gt;
*ドメイン管理者以外のアカウントがWindowsで権限を設定できるようにするには、&amp;lt;code&amp;gt;SeDiskOperatorPrivilege&amp;lt;/code&amp;gt;特権を付与したユーザーまたはグループに&amp;lt;code&amp;gt;フルコントロール&amp;lt;/code&amp;gt;（&amp;lt;code&amp;gt; rwx &amp;lt;/code&amp;gt;）を付与します。 例えば：&lt;br /&gt;
&lt;br /&gt;
 # chown root:&amp;quot;Domain Admins&amp;quot; /srv/samba/Demo/&lt;br /&gt;
 # chmod 0770 /srv/samba/Demo/&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt; [Demo] &amp;lt;/code&amp;gt;共有定義を&amp;lt;code&amp;gt; smb.conf &amp;lt;/code&amp;gt;ファイルに追加します。&lt;br /&gt;
&lt;br /&gt;
 [Demo]&lt;br /&gt;
        path = /srv/samba/Demo/&lt;br /&gt;
        read only = no&lt;br /&gt;
&lt;br /&gt;
: 共有固有の詳細設定とファイルシステムのアクセス許可は、Windowsのユーティリティを使用して設定します。&lt;br /&gt;
&lt;br /&gt;
:{{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| text = &amp;lt;code&amp;gt; force user &amp;lt;/code&amp;gt;などの追加の共有パラメータを設定しないでください。 それらを共有定義に追加すると、共有を構成または使用できなくなる可能性があります。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Sambaの設定を再読み込みする:&lt;br /&gt;
&lt;br /&gt;
 # smbcontrol all reload-config&lt;br /&gt;
&lt;br /&gt;
=共有許可とACLの設定=&lt;br /&gt;
&lt;br /&gt;
拡張アクセス制御リスト（ACL）をサポートする共有を設定するときは、&amp;lt;code&amp;gt; smb.conf &amp;lt;/code&amp;gt;ファイルの共有セクションにパラメータを追加するのではなく、Windowsユーティリティを使用して共有アクセス権を設定します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; Demo &amp;lt;/code&amp;gt;共有にアクセス許可とACLを設定するには：&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt; SeDiskOperatorPrivilege &amp;lt;/code&amp;gt;権限が付与されているアカウントを使用してWindowsホストにログオンします。 例えば &amp;lt;code&amp;gt; SAMDOM \ Administrator &amp;lt;/code&amp;gt;または&amp;lt;code&amp;gt; SAMDOM \ john &amp;lt;/code&amp;gt; &amp;lt;code&amp;gt; john &amp;lt;/code&amp;gt;は&amp;lt;code&amp;gt; Domain Admins &amp;lt;/code&amp;gt;のメンバーです。&lt;br /&gt;
* [&amp;lt;code&amp;gt;開始&amp;lt;/code&amp;gt;]をクリックし、&amp;lt;code&amp;gt;コンピュータの管理&amp;lt;/code&amp;gt;と入力してアプリケーションを起動します。&lt;br /&gt;
* [&amp;lt;code&amp;gt;操作&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;別のコンピュータに接続&amp;lt;/code&amp;gt;]を選択します。&lt;br /&gt;
* Sambaホストの名前を入力し、&amp;lt;code&amp;gt; OK &amp;lt;/code&amp;gt;をクリックしてコンソールをホストに接続します。&lt;br /&gt;
* &amp;lt;code&amp;gt;システムツール&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;共有フォルダ&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;共有&amp;lt;/code&amp;gt;メニューを開きます。&lt;br /&gt;
:[[Image:Computer_Management_Shares.png]]&lt;br /&gt;
*共有を右クリックして、&amp;lt;code&amp;gt;プロパティ&amp;lt;/code&amp;gt;を選択します。&lt;br /&gt;
* [&amp;lt;code&amp;gt;共有アクセス権&amp;lt;/code&amp;gt;]タブを選択し、共有アクセス権を確認します。&amp;lt;code&amp;gt; Everyone &amp;lt;/code&amp;gt;が表示される必要があります。 例えば：&lt;br /&gt;
:[[Image:share.png]]&lt;br /&gt;
: Sambaは&amp;lt;code&amp;gt; /usr/local/samba/var/locks/share_info.tdb &amp;lt;/code&amp;gt;データベースに共有許可を保存します。&lt;br /&gt;
* [&amp;lt;code&amp;gt;セキュリティ&amp;lt;/code&amp;gt;]タブをクリックします。&lt;br /&gt;
* &amp;lt;code&amp;gt;編集&amp;lt;/code&amp;gt;ボタンをクリックして、共有のルートディレクトリにファイルシステムのACLを設定します。 例えば：&lt;br /&gt;
:[[Image:Demo_Share_Security.png]]&lt;br /&gt;
: Samba共有で&amp;lt;code&amp;gt; SYSTEM &amp;lt;/code&amp;gt;アカウントを使うことについての詳細は[[SYSTEMアカウント]]を見てください。&lt;br /&gt;
: ACLが格納される場所の詳細については、[[#バックエンドのファイルシステムACL |バックエンドのファイルシステムACL]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;追加&amp;lt;/code&amp;gt;ボタンをクリックしてください。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;詳細&amp;lt;/code&amp;gt;ボタンをクリック&lt;br /&gt;
&lt;br /&gt;
* [&amp;lt;code&amp;gt;今すぐ検索&amp;lt;/code&amp;gt;]をクリックします&lt;br /&gt;
&lt;br /&gt;
*リストからユーザーまたはグループを選択します（例：&amp;lt;code&amp;gt; Domain Users &amp;lt;/code&amp;gt;）。&lt;br /&gt;
&lt;br /&gt;
* [&amp;lt;code&amp;gt; OK &amp;lt;/code&amp;gt;]をクリックします&lt;br /&gt;
&lt;br /&gt;
* [&amp;lt;code&amp;gt; OK &amp;lt;/code&amp;gt;]をクリックします&lt;br /&gt;
&lt;br /&gt;
*付与する権限を選択します。たとえば、&amp;lt;code&amp;gt;フルコントロール&amp;lt;/code&amp;gt;です。&lt;br /&gt;
&lt;br /&gt;
*続行するかどうかを尋ねるウィンドウズのセキュリティボックスが開きます。&amp;lt;code&amp;gt; Yes &amp;lt;/code&amp;gt;をクリックしてください。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;グループ名またはユーザー名&amp;lt;/code&amp;gt;のリストを確認すると、&amp;lt;code&amp;gt; Domain Users &amp;lt;/code&amp;gt;がリストされているはずです。&lt;br /&gt;
&lt;br /&gt;
* [&amp;lt;code&amp;gt; OK &amp;lt;/code&amp;gt;]をクリックして[&amp;lt;code&amp;gt;デモのアクセス許可&amp;lt;/code&amp;gt;]ウィンドウを閉じます。&lt;br /&gt;
&lt;br /&gt;
*更新した設定を保存するには、[&amp;lt;code&amp;gt; OK &amp;lt;/code&amp;gt;]をクリックします。&lt;br /&gt;
&lt;br /&gt;
共有権限とACLの設定について詳しくは、Windowsの資料を参照してください。&lt;br /&gt;
&lt;br /&gt;
= フォルダにACLを設定する =&lt;br /&gt;
&lt;br /&gt;
拡張アクセス制御リスト（ACL）を使用する共有上にあるフォルダーにファイルシステムのアクセス許可を設定するには&lt;br /&gt;
&lt;br /&gt;
*ファイルシステムのACLを変更するフォルダに&amp;lt;code&amp;gt;フルコントロール&amp;lt;/code&amp;gt;を持つアカウントを使用してWindowsホストにログオンします。&lt;br /&gt;
&lt;br /&gt;
*フォルダに移動します。&lt;br /&gt;
&lt;br /&gt;
*フォルダを右クリックして、&amp;lt;code&amp;gt;プロパティ&amp;lt;/code&amp;gt;を選択します。&lt;br /&gt;
&lt;br /&gt;
* [&amp;lt;code&amp;gt;セキュリティ&amp;lt;/code&amp;gt;]タブを選択し、[&amp;lt;code&amp;gt;編集&amp;lt;/code&amp;gt;]ボタンをクリックします。&lt;br /&gt;
&lt;br /&gt;
*許可を設定してください。 例えば:&lt;br /&gt;
&lt;br /&gt;
:[[Image:Folder_Permissions.png]]&lt;br /&gt;
&lt;br /&gt;
：Samba共有で&amp;lt;code&amp;gt; SYSTEM &amp;lt;/code&amp;gt;アカウントを使うことについての詳細は[[SYSTEMアカウント]]を見てください。&lt;br /&gt;
&lt;br /&gt;
：ACLが格納される場所の詳細については、[[#バックエンドのファイルシステムACL |バックエンドのファイルシステムACL]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
* [&amp;lt;code&amp;gt; OK &amp;lt;/code&amp;gt;]をクリックして[&amp;lt;code&amp;gt;フォルダのアクセス許可&amp;lt;/code&amp;gt;]ウィンドウを閉じます。&lt;br /&gt;
&lt;br /&gt;
*更新した設定を保存するには、[&amp;lt;code&amp;gt; OK &amp;lt;/code&amp;gt;]をクリックします。&lt;br /&gt;
&lt;br /&gt;
ACLの設定について詳しくは、Windowsの資料を参照してください。&lt;br /&gt;
&lt;br /&gt;
= バックエンドのファイルシステムACL =&lt;br /&gt;
&lt;br /&gt;
Sambaはファイルシステムのアクセス権を拡張ファイルシステムのアクセス制御リスト（ACL）と拡張属性に格納します。 例えば：&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/srv/samba/Demo/&amp;lt;/code&amp;gt;ディレクトリの拡張ACLを一覧表示するには、次のように入力します。:&lt;br /&gt;
&lt;br /&gt;
 # getfacl /srv/samba/Demo/&lt;br /&gt;
 # file: srv/samba/Demo/&lt;br /&gt;
 # owner: root&lt;br /&gt;
 # group: root&lt;br /&gt;
 user::rwx&lt;br /&gt;
 user:root:rwx&lt;br /&gt;
 group::---&lt;br /&gt;
 group:root:---&lt;br /&gt;
 group:domain\040users:rwx&lt;br /&gt;
 group:domain\040admins:rwx&lt;br /&gt;
 mask::rwx&lt;br /&gt;
 other::---&lt;br /&gt;
 default:user::rwx&lt;br /&gt;
 default:user:root:rwx&lt;br /&gt;
 default:group::---&lt;br /&gt;
 default:group:root:---&lt;br /&gt;
 default:group:domain\040users:rwx&lt;br /&gt;
 default:group:domain\040admins:rwx&lt;br /&gt;
 default:mask::rwx&lt;br /&gt;
 default:other::---&lt;br /&gt;
&lt;br /&gt;
* ディレクトリ、&amp;lt;code&amp;gt;/srv/samba/Demo/&amp;lt;/code&amp;gt;の&amp;lt;code&amp;gt;security.NTACL&amp;lt;/code&amp;gt;の拡張属性の一覧を表示するには、次のように入力:&lt;br /&gt;
&lt;br /&gt;
 # getfattr -n security.NTACL -d /srv/samba/Demo/&lt;br /&gt;
 # file: srv/samba/Demo/&lt;br /&gt;
 security.NTACL=0sBAAEAAAAAgAEAAIAAQC4zK0lHchKFvwXwbPR/h8P8sXMj5dNIT5QQuWsYwO3RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcG9zaXhfYWNsAEbGxuGu39MBuiZRk2pYxeL5ZWc4au0ikqRAk53MkjVd2b4quyk2WwcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEABJy0AAAA0AAAAAAAAADsAAAAAQUAAAAAAAUVAAAASSVmaZneO8cxOHk/9AEAAAEFAAAAAAAFFQAAAEklZmmZ3jvHMTh5P0oIAAACAMQABwAAAAALFACpABIAAQEAAAAAAAEAAAAAAAAUAAAAEAABAQAAAAAAAQAAAAAACxQA/wEfAAEBAAAAAAADAAAAAAALFACpABIAAQEAAAAAAAMBAAAAAAMkAP8BHwABBQAAAAAABRUAAABJJWZpmd47xzE4eT9KCAAAAAAkAP8BHwABBQAAAAAABRUAAABJJWZpmd47xzE4eT/0AQAAAAMkAL8BEwABBQAAAAAABRUAAABJJWZpmd47xzE4eT8BAgAA&lt;br /&gt;
&lt;br /&gt;
ファイルシステムACLと拡張属性の前の例は、次のWindows ACLにマップされています:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Principal&lt;br /&gt;
!Permissions&lt;br /&gt;
!Applies to&lt;br /&gt;
|-&lt;br /&gt;
|Domain Users (SAMDOM\Domain Users)&lt;br /&gt;
|Modify, Read &amp;amp; execute, List folder contents, Read, Write&lt;br /&gt;
|(This folder, subfolders and files)&lt;br /&gt;
|-&lt;br /&gt;
|Domain Admins (SAMDOM\Domain Admins)&lt;br /&gt;
|Full control&lt;br /&gt;
|(This folder, subfolders and files)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* もっと読みやすい形式でACLを取得するには、次のように入力します。:&lt;br /&gt;
&lt;br /&gt;
 # samba-tool ntacl get /usr/local/samba/var/locks/sysvol --as-sddl&lt;br /&gt;
 # 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)&lt;br /&gt;
&lt;br /&gt;
= トラブルシューティング = &lt;br /&gt;
&lt;br /&gt;
トラブルシューティングは、次の項目を参照してください:&lt;br /&gt;
* [[Sambaドメインメンバーのトラブルシューティング | Sambaドメインメンバーのトラブルシューティング]]&lt;br /&gt;
* [[Samba AD DCトラブルシューティング| Samba AD DCトラブルシューティング]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;br /&gt;
[[Category:Domain Members]]&lt;br /&gt;
[[Category:File Serving]]&lt;br /&gt;
[[Category:NT4 Domains]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=ADUC%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%9FAD%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8BUnix%E5%B1%9E%E6%80%A7%E3%81%AE%E7%AE%A1%E7%90%86&amp;diff=10065</id>
		<title>ADUCを使用したADにおけるUnix属性の管理</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=ADUC%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%9FAD%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8BUnix%E5%B1%9E%E6%80%A7%E3%81%AE%E7%AE%A1%E7%90%86&amp;diff=10065"/>
		<updated>2019-05-17T04:25:28Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* はじめに */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
以下では、[[idmap config ad]]によって使用されるRFC2307属性を設定/編集する方法について説明します。 これには、ADに[[ADにRFC2307を設定する#ドメインコントローラとActive Directoryのセットアップを確認する|NIS拡張機能]]をイ ンストールする必要があります。 Windows GUIを使用してUNIX属性を管理するには、[[RSATのインストール|RSAT（Remote Server Administration Tools）]]をインストールする必要があります。まだインストールしていない場合はインストールし、詳細ビュー（「表示」/「拡張機能」）を有効にする必要がありま す。 [[委任/アカウント管理|委任]]を設定していない場合は、ドメイン管理者がユーザーおよびグループオブジェクトの変更を行います。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%&lt;br /&gt;
| text = Windows 10およびWindows Server 2016で実行されているADUCは、ユーザーまたはグループのプロパティに&amp;quot;Unix属性&amp;quot;タブが表示されなくなりました。 詳細については、[[RSATのインストール#Windows 10およびWindows Server 2016のADUCにUnix属性タブがない | Windows 10およびWindows Server 2016のADUCに&amp;quot;Unix属性&amp;quot;タブがない]]を参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== ユーザーアカウントに属性を設定する ==&lt;br /&gt;
&lt;br /&gt;
* ADUCを開きます。&lt;br /&gt;
* ユーザーアカウントを右クリックし、プロパティを選択します。&lt;br /&gt;
* [UNIX属性]タブに移動します。&lt;br /&gt;
: 注：このタブが表示されない場合は、[[RSATのインストール|RSAT機能「Server for NIS Tools」]]はインストールされていません。&lt;br /&gt;
* 他のフィールドは、「NISドメイン」が選択されるまで有効になりません。 必要に応じて値を入力します。&lt;br /&gt;
: ヒント：[[#グループの属性の設定|Unix属性が定義されている]]プライマリグループのみを選択できます。&lt;br /&gt;
&lt;br /&gt;
:[[Image:ADUC_UNIX_Attributes_User.png]]&lt;br /&gt;
&lt;br /&gt;
* 「OK」をクリックして変更を保存します。&lt;br /&gt;
&lt;br /&gt;
== グループの属性の設定 ==&lt;br /&gt;
&lt;br /&gt;
* ADUCを開きます。&lt;br /&gt;
* グループを右クリックし、プロパティを選択します。&lt;br /&gt;
* [UNIX属性]タブに移動します。&lt;br /&gt;
* 注：タブが表示されていない場合は、RSAT機能「Server for NIS Tools」はインストールされていません。&lt;br /&gt;
* 「NISドメイン」を選択するまで、他のフィールドは有効になっていません。必要に応じて値を入力してください。&lt;br /&gt;
&lt;br /&gt;
ヒント：このタブでユーザーをグループに追加する必要はありません。 Winbindは、Windowsグループからアカウントメンバーシップを取得しま す（「Member Of」タブを参照）。&lt;br /&gt;
&lt;br /&gt;
:[[Image:ADUC_UNIX_Attributes_Groups.png]]&lt;br /&gt;
&lt;br /&gt;
* 「OK」をクリックして変更を保存します。&lt;br /&gt;
&lt;br /&gt;
== コンピュータアカウントの属性の設定 ==&lt;br /&gt;
&lt;br /&gt;
Windowsマシンのネットワークアカウントを持つドメイン上のsamba共有にアクセスするには、uidNumber属性を設定する必要があります。&lt;br /&gt;
&lt;br /&gt;
* ADUCを開きます。&lt;br /&gt;
* コンピュータアカウントを右クリックし、プロパティを選択します。&lt;br /&gt;
* [アトリビュートエディタ]タブに移動します。&lt;br /&gt;
* 注：このタブが表示されない場合は、RSAT機能「Server for NIS Tools」はインストールされていません。&lt;br /&gt;
* 「uidNumber」属性までスクロールして選択し、「編集」をクリックして値を入力し、「OK」をクリックします。&lt;br /&gt;
* 注：一意の値を入力してください。&lt;br /&gt;
* [OK]をクリックして変更を保存します。&lt;br /&gt;
&lt;br /&gt;
== 使用する次のUID / GID番号の定義 ==&lt;br /&gt;
&lt;br /&gt;
Active Directoryユーザーとコンピュータ（ADUC）を使用してUID / GID番号が割り当てられるたびに、次のUID / GID番号がActive Directory内に格納されます。 デフォルトでは、ADUCは10000でUIDとGID番号の割り当てを開始します。&lt;br /&gt;
&lt;br /&gt;
新しいSamba ADを設定して別の開始値を使用する場合は、初めてADUCを使用する前にカウント属性を追加する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# ldbedit -H /usr/local/samba/private/sam.ldb -b \&lt;br /&gt;
  CN=samdom,CN=ypservers,CN=ypServ30,CN=RpcServices,CN=System,DC=samdom,DC=example,DC=com&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;msSFU30MaxUidNumber: 10000&lt;br /&gt;
msSFU30MaxGidNumber: 10000&amp;lt;/pre&amp;gt;&lt;br /&gt;
同じコマンドで値を変更することができます。 E. 20000でUID番号を、50000でGIDを開始する必要がある場合は、値を要件に適合させます。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;msSFU30MaxUidNumber: 20000&lt;br /&gt;
msSFU30MaxGidNumber: 50000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[category:Active Directory]]&lt;br /&gt;
[[category:User Management]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=RSAT%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB&amp;diff=10064</id>
		<title>RSATのインストール</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=RSAT%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB&amp;diff=10064"/>
		<updated>2019-05-17T04:24:34Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Missing Unix Attributes tab in ADUC on Windows 10 and Windows Server 2016 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
Windows から Active Directory(AD) を管理するためには、Microsoft リモートサーバー管理ツール (RSAT) を使用します。ツールは全てのプラットフォームで使用ができ、Microsoft も積極的にサポートしています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ダウンロード =&lt;br /&gt;
&lt;br /&gt;
* Windows 10: https://www.microsoft.com/en-us/download/details.aspx?id=45520&lt;br /&gt;
&lt;br /&gt;
* Windows 8.1: http://www.microsoft.com/en-us/download/details.aspx?id=39296&lt;br /&gt;
&lt;br /&gt;
* Windows 8: http://www.microsoft.com/en-us/download/details.aspx?id=28972&lt;br /&gt;
&lt;br /&gt;
* Windows 7: http://www.microsoft.com/en-us/download/details.aspx?id=7887&lt;br /&gt;
&lt;br /&gt;
* Windows Vista: http://www.microsoft.com/en-us/download/details.aspx?id=21090&lt;br /&gt;
&lt;br /&gt;
Windows Server オペレーティングシステムには、Microsoftリモートサーバー管理ツール (RSAT)が含まれています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= インストール =&lt;br /&gt;
&lt;br /&gt;
== Windows 8 以降 ==&lt;br /&gt;
&lt;br /&gt;
* ダウロードしたインストーラを実行して、支持に従ってください。すべての機能が自動的にインストールされます。&lt;br /&gt;
&lt;br /&gt;
== Windows Vista and 7 ==&lt;br /&gt;
&lt;br /&gt;
* Start the downloaded installer and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
* Click &amp;lt;code&amp;gt;Start&amp;lt;/code&amp;gt;, enter &amp;lt;code&amp;gt;Programs and Features&amp;lt;/code&amp;gt; into the search field and start the application.&lt;br /&gt;
&lt;br /&gt;
* Select the features to install:&lt;br /&gt;
: The following are the recommended features to administer a Samba Active Directory installation:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Group Policy Management Tools&lt;br /&gt;
|Provides the Group Policy MMC Snap-ins: Management Tool, Management Editor and Starter GPO Editor.&lt;br /&gt;
|-&lt;br /&gt;
|Active Directory Module for Windows PowerShell&lt;br /&gt;
|Optional. Enables Active Directory (AD) PowerShell cmdlets.&lt;br /&gt;
|-&lt;br /&gt;
|AD DS Tools&lt;br /&gt;
|Provides the &amp;lt;code&amp;gt;Active Directory Users and Computers&amp;lt;/code&amp;gt; (ADUC) and &amp;lt;code&amp;gt;Active Directory Sites and Services&amp;lt;/code&amp;gt; MMC Snap-in.&lt;br /&gt;
|-&lt;br /&gt;
|Server for NIS Tools&lt;br /&gt;
|Adds the &amp;lt;code&amp;gt;UNIX Attributes&amp;lt;/code&amp;gt; tab to ADUC objects properties. It enables you to configure [[Idmap_config_ad|RFC2307 attributes]].&lt;br /&gt;
|-&lt;br /&gt;
|DNS Server tools&lt;br /&gt;
|DNS MMC Snap-in for remote DNS management.&lt;br /&gt;
|-&lt;br /&gt;
|Remote Desktop Services Tool&lt;br /&gt;
|Optional. Adds the &amp;lt;code&amp;gt;Remote Desktop Services Profile&amp;lt;/code&amp;gt; tab to the ADUC user object&#039;s properties and installs the &amp;lt;code&amp;gt;RDP server administration&amp;lt;/code&amp;gt; MMC Snap-in. Install this feature to configure remote desktop protocol (RDP) settings in ADUC.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Click &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt; to install the features.&lt;br /&gt;
&lt;br /&gt;
You can find the installed tools in the &amp;lt;code&amp;gt;Administrative tools&amp;lt;/code&amp;gt; menu in your start menu. Alternatively, add the Snap-ins in the MMC using the &amp;lt;code&amp;gt;File&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;Add/Remove Snap-in&amp;lt;/code&amp;gt; menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Windows Server ==&lt;br /&gt;
&lt;br /&gt;
* Start the &amp;lt;code&amp;gt;Server Manager&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* On Windows Server 2012, 2012 R2, and 2016:&lt;br /&gt;
:* Click &amp;lt;code&amp;gt;Add roles and features&amp;lt;/code&amp;gt;.&lt;br /&gt;
:* Select &amp;lt;code&amp;gt;Role-based or feature-based installation&amp;lt;/code&amp;gt;.&lt;br /&gt;
:* Select the host on which to install the features.&lt;br /&gt;
:* Click &amp;lt;code&amp;gt;Next&amp;lt;/code&amp;gt; on the &amp;lt;code&amp;gt;Roles&amp;lt;/code&amp;gt; page.&lt;br /&gt;
&lt;br /&gt;
* On Windows Server 2008 and 2008 R2:&lt;br /&gt;
:*Select &amp;lt;code&amp;gt;Features&amp;lt;/code&amp;gt; in the navigation tree and click &amp;lt;code&amp;gt;Add Features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Select the features to install:&lt;br /&gt;
: The following are the recommended features to administer a Samba Active Directory installation:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Group Policy Management&lt;br /&gt;
|Provides the Group Policy MMC Snap-ins: Management Tool, Management Editor and Starter GPO Editor.&lt;br /&gt;
|-&lt;br /&gt;
|AD DS Snap-Ins and Command-Line Tools&lt;br /&gt;
|Optional. Provides the &amp;lt;code&amp;gt;Active Directory Users and Computers&amp;lt;/code&amp;gt; (ADUC) and &amp;lt;code&amp;gt;Active Directory Sites and Services&amp;lt;/code&amp;gt; MMC Snap-in.&lt;br /&gt;
|-&lt;br /&gt;
|Server for NIS Tools&lt;br /&gt;
|Adds the &amp;lt;code&amp;gt;UNIX Attributes&amp;lt;/code&amp;gt; tab to ADUC objects properties. It enables you to configure [[Idmap_config_ad|RFC2307 attributes]].&amp;lt;br /&amp;gt;This feature is not supported in Windows Server 2016. For details, see [[#Missing_.22Unix_Attributes.22_tab_in_ADUC_on_Windows_10|Missing &amp;quot;Unix Attributes&amp;quot; tab in ADUC on Windows 10 and Windows Server 2016]].&lt;br /&gt;
|-&lt;br /&gt;
|Active Directory Module for Windows PowerShell&lt;br /&gt;
|Enables Active Directory (AD) PowerShell cmdlets.&lt;br /&gt;
|-&lt;br /&gt;
|DNS Server tools&lt;br /&gt;
|DNS MMC Snap-in for remote DNS management.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Enabling the &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt; Mode =&lt;br /&gt;
&lt;br /&gt;
Many Remote Server Administration Tools (RSAT) provide additional features and options after enabling the &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt; option. To activate:&lt;br /&gt;
&lt;br /&gt;
* Select the root of the navigation tree on the left side.&lt;br /&gt;
&lt;br /&gt;
* Open the &amp;lt;code&amp;gt;View&amp;lt;/code&amp;gt; menu.&lt;br /&gt;
&lt;br /&gt;
* Select &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:[[Image:ADUC_Enabling_Advanced_Features.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Windows 10およびWindows Server 2016のADUCに&amp;lt;code&amp;gt;Unix属性&amp;lt;/code&amp;gt;タブがない =&lt;br /&gt;
&lt;br /&gt;
Windows 10 and Windows Server 2016 do not support the &amp;lt;code&amp;gt;Server for NIS Tools&amp;lt;/code&amp;gt; option. Without this feature, the Active Directory User and Computer (ADUC) console does not show the &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab on user and group objects. To work around this problem, set the attributes in Active Directory (AD) manually or use a different Windows operating system.&lt;br /&gt;
&lt;br /&gt;
To manually set the attributes, use the &amp;lt;code&amp;gt;Attributes&amp;lt;/code&amp;gt; tab on user and group object&#039;s properties. Note that this tab is only visible if you enabled the advanced features in ADUC. For further details, see [[#Enabling_the_Advanced_Features_Mode|Enabling the &amp;quot;Advanced Features&amp;quot; Mode]].&lt;br /&gt;
&lt;br /&gt;
The fields from the &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab are mapped to the following AD attributes of the object:&lt;br /&gt;
&lt;br /&gt;
* Users:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field on the &amp;quot;Unix Attributes&amp;quot; tab&lt;br /&gt;
!Active Directory attribute&lt;br /&gt;
|-&lt;br /&gt;
|NIS Domain&lt;br /&gt;
|msSFU30NisDomain&lt;br /&gt;
|-&lt;br /&gt;
|UID&lt;br /&gt;
|uidNumber&lt;br /&gt;
|-&lt;br /&gt;
|Logon Shell&lt;br /&gt;
|loginShell&lt;br /&gt;
|-&lt;br /&gt;
|Home Directory&lt;br /&gt;
|unixHomeDirectory&lt;br /&gt;
|-&lt;br /&gt;
|Primary group name/GID&lt;br /&gt;
|primaryGroupID&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Groups:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field on the &amp;quot;Unix Attributes&amp;quot; tab&lt;br /&gt;
!Active Directory attribute&lt;br /&gt;
|-&lt;br /&gt;
|NIS Domain&lt;br /&gt;
|msSFU30NisDomain&lt;br /&gt;
|-&lt;br /&gt;
|GID (Group ID)&lt;br /&gt;
|gidNumber&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = note&lt;br /&gt;
| text = If you set user IDs (UID) and group IDs (GID) manually, you must also track the last used UID and GID numbers manually.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Reporting Problems and Incompatibilities =&lt;br /&gt;
&lt;br /&gt;
To report problems or incompatibilities when using the Microsoft Remote Server Administration Tools (RSAT), see [[Bug_Reporting|Bug Reporting]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;br /&gt;
[[Category:User Management]]&lt;br /&gt;
[[Category:Group Policy Management]]&lt;br /&gt;
[[Category:DNS]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=RSAT%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB&amp;diff=10063</id>
		<title>RSATのインストール</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=RSAT%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB&amp;diff=10063"/>
		<updated>2019-05-14T08:09:02Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Windows 8 and later */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
Windows から Active Directory(AD) を管理するためには、Microsoft リモートサーバー管理ツール (RSAT) を使用します。ツールは全てのプラットフォームで使用ができ、Microsoft も積極的にサポートしています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ダウンロード =&lt;br /&gt;
&lt;br /&gt;
* Windows 10: https://www.microsoft.com/en-us/download/details.aspx?id=45520&lt;br /&gt;
&lt;br /&gt;
* Windows 8.1: http://www.microsoft.com/en-us/download/details.aspx?id=39296&lt;br /&gt;
&lt;br /&gt;
* Windows 8: http://www.microsoft.com/en-us/download/details.aspx?id=28972&lt;br /&gt;
&lt;br /&gt;
* Windows 7: http://www.microsoft.com/en-us/download/details.aspx?id=7887&lt;br /&gt;
&lt;br /&gt;
* Windows Vista: http://www.microsoft.com/en-us/download/details.aspx?id=21090&lt;br /&gt;
&lt;br /&gt;
Windows Server オペレーティングシステムには、Microsoftリモートサーバー管理ツール (RSAT)が含まれています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= インストール =&lt;br /&gt;
&lt;br /&gt;
== Windows 8 以降 ==&lt;br /&gt;
&lt;br /&gt;
* ダウロードしたインストーラを実行して、支持に従ってください。すべての機能が自動的にインストールされます。&lt;br /&gt;
&lt;br /&gt;
== Windows Vista and 7 ==&lt;br /&gt;
&lt;br /&gt;
* Start the downloaded installer and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
* Click &amp;lt;code&amp;gt;Start&amp;lt;/code&amp;gt;, enter &amp;lt;code&amp;gt;Programs and Features&amp;lt;/code&amp;gt; into the search field and start the application.&lt;br /&gt;
&lt;br /&gt;
* Select the features to install:&lt;br /&gt;
: The following are the recommended features to administer a Samba Active Directory installation:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Group Policy Management Tools&lt;br /&gt;
|Provides the Group Policy MMC Snap-ins: Management Tool, Management Editor and Starter GPO Editor.&lt;br /&gt;
|-&lt;br /&gt;
|Active Directory Module for Windows PowerShell&lt;br /&gt;
|Optional. Enables Active Directory (AD) PowerShell cmdlets.&lt;br /&gt;
|-&lt;br /&gt;
|AD DS Tools&lt;br /&gt;
|Provides the &amp;lt;code&amp;gt;Active Directory Users and Computers&amp;lt;/code&amp;gt; (ADUC) and &amp;lt;code&amp;gt;Active Directory Sites and Services&amp;lt;/code&amp;gt; MMC Snap-in.&lt;br /&gt;
|-&lt;br /&gt;
|Server for NIS Tools&lt;br /&gt;
|Adds the &amp;lt;code&amp;gt;UNIX Attributes&amp;lt;/code&amp;gt; tab to ADUC objects properties. It enables you to configure [[Idmap_config_ad|RFC2307 attributes]].&lt;br /&gt;
|-&lt;br /&gt;
|DNS Server tools&lt;br /&gt;
|DNS MMC Snap-in for remote DNS management.&lt;br /&gt;
|-&lt;br /&gt;
|Remote Desktop Services Tool&lt;br /&gt;
|Optional. Adds the &amp;lt;code&amp;gt;Remote Desktop Services Profile&amp;lt;/code&amp;gt; tab to the ADUC user object&#039;s properties and installs the &amp;lt;code&amp;gt;RDP server administration&amp;lt;/code&amp;gt; MMC Snap-in. Install this feature to configure remote desktop protocol (RDP) settings in ADUC.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Click &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt; to install the features.&lt;br /&gt;
&lt;br /&gt;
You can find the installed tools in the &amp;lt;code&amp;gt;Administrative tools&amp;lt;/code&amp;gt; menu in your start menu. Alternatively, add the Snap-ins in the MMC using the &amp;lt;code&amp;gt;File&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;Add/Remove Snap-in&amp;lt;/code&amp;gt; menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Windows Server ==&lt;br /&gt;
&lt;br /&gt;
* Start the &amp;lt;code&amp;gt;Server Manager&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* On Windows Server 2012, 2012 R2, and 2016:&lt;br /&gt;
:* Click &amp;lt;code&amp;gt;Add roles and features&amp;lt;/code&amp;gt;.&lt;br /&gt;
:* Select &amp;lt;code&amp;gt;Role-based or feature-based installation&amp;lt;/code&amp;gt;.&lt;br /&gt;
:* Select the host on which to install the features.&lt;br /&gt;
:* Click &amp;lt;code&amp;gt;Next&amp;lt;/code&amp;gt; on the &amp;lt;code&amp;gt;Roles&amp;lt;/code&amp;gt; page.&lt;br /&gt;
&lt;br /&gt;
* On Windows Server 2008 and 2008 R2:&lt;br /&gt;
:*Select &amp;lt;code&amp;gt;Features&amp;lt;/code&amp;gt; in the navigation tree and click &amp;lt;code&amp;gt;Add Features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Select the features to install:&lt;br /&gt;
: The following are the recommended features to administer a Samba Active Directory installation:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Group Policy Management&lt;br /&gt;
|Provides the Group Policy MMC Snap-ins: Management Tool, Management Editor and Starter GPO Editor.&lt;br /&gt;
|-&lt;br /&gt;
|AD DS Snap-Ins and Command-Line Tools&lt;br /&gt;
|Optional. Provides the &amp;lt;code&amp;gt;Active Directory Users and Computers&amp;lt;/code&amp;gt; (ADUC) and &amp;lt;code&amp;gt;Active Directory Sites and Services&amp;lt;/code&amp;gt; MMC Snap-in.&lt;br /&gt;
|-&lt;br /&gt;
|Server for NIS Tools&lt;br /&gt;
|Adds the &amp;lt;code&amp;gt;UNIX Attributes&amp;lt;/code&amp;gt; tab to ADUC objects properties. It enables you to configure [[Idmap_config_ad|RFC2307 attributes]].&amp;lt;br /&amp;gt;This feature is not supported in Windows Server 2016. For details, see [[#Missing_.22Unix_Attributes.22_tab_in_ADUC_on_Windows_10|Missing &amp;quot;Unix Attributes&amp;quot; tab in ADUC on Windows 10 and Windows Server 2016]].&lt;br /&gt;
|-&lt;br /&gt;
|Active Directory Module for Windows PowerShell&lt;br /&gt;
|Enables Active Directory (AD) PowerShell cmdlets.&lt;br /&gt;
|-&lt;br /&gt;
|DNS Server tools&lt;br /&gt;
|DNS MMC Snap-in for remote DNS management.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Enabling the &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt; Mode =&lt;br /&gt;
&lt;br /&gt;
Many Remote Server Administration Tools (RSAT) provide additional features and options after enabling the &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt; option. To activate:&lt;br /&gt;
&lt;br /&gt;
* Select the root of the navigation tree on the left side.&lt;br /&gt;
&lt;br /&gt;
* Open the &amp;lt;code&amp;gt;View&amp;lt;/code&amp;gt; menu.&lt;br /&gt;
&lt;br /&gt;
* Select &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:[[Image:ADUC_Enabling_Advanced_Features.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Missing &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab in ADUC on Windows 10 and Windows Server 2016 =&lt;br /&gt;
&lt;br /&gt;
Windows 10 and Windows Server 2016 do not support the &amp;lt;code&amp;gt;Server for NIS Tools&amp;lt;/code&amp;gt; option. Without this feature, the Active Directory User and Computer (ADUC) console does not show the &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab on user and group objects. To work around this problem, set the attributes in Active Directory (AD) manually or use a different Windows operating system.&lt;br /&gt;
&lt;br /&gt;
To manually set the attributes, use the &amp;lt;code&amp;gt;Attributes&amp;lt;/code&amp;gt; tab on user and group object&#039;s properties. Note that this tab is only visible if you enabled the advanced features in ADUC. For further details, see [[#Enabling_the_Advanced_Features_Mode|Enabling the &amp;quot;Advanced Features&amp;quot; Mode]].&lt;br /&gt;
&lt;br /&gt;
The fields from the &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab are mapped to the following AD attributes of the object:&lt;br /&gt;
&lt;br /&gt;
* Users:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field on the &amp;quot;Unix Attributes&amp;quot; tab&lt;br /&gt;
!Active Directory attribute&lt;br /&gt;
|-&lt;br /&gt;
|NIS Domain&lt;br /&gt;
|msSFU30NisDomain&lt;br /&gt;
|-&lt;br /&gt;
|UID&lt;br /&gt;
|uidNumber&lt;br /&gt;
|-&lt;br /&gt;
|Logon Shell&lt;br /&gt;
|loginShell&lt;br /&gt;
|-&lt;br /&gt;
|Home Directory&lt;br /&gt;
|unixHomeDirectory&lt;br /&gt;
|-&lt;br /&gt;
|Primary group name/GID&lt;br /&gt;
|primaryGroupID&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Groups:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field on the &amp;quot;Unix Attributes&amp;quot; tab&lt;br /&gt;
!Active Directory attribute&lt;br /&gt;
|-&lt;br /&gt;
|NIS Domain&lt;br /&gt;
|msSFU30NisDomain&lt;br /&gt;
|-&lt;br /&gt;
|GID (Group ID)&lt;br /&gt;
|gidNumber&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = note&lt;br /&gt;
| text = If you set user IDs (UID) and group IDs (GID) manually, you must also track the last used UID and GID numbers manually.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Reporting Problems and Incompatibilities =&lt;br /&gt;
&lt;br /&gt;
To report problems or incompatibilities when using the Microsoft Remote Server Administration Tools (RSAT), see [[Bug_Reporting|Bug Reporting]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;br /&gt;
[[Category:User Management]]&lt;br /&gt;
[[Category:Group Policy Management]]&lt;br /&gt;
[[Category:DNS]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=RSAT%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB&amp;diff=10062</id>
		<title>RSATのインストール</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=RSAT%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB&amp;diff=10062"/>
		<updated>2019-05-14T08:07:31Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
Windows から Active Directory(AD) を管理するためには、Microsoft リモートサーバー管理ツール (RSAT) を使用します。ツールは全てのプラットフォームで使用ができ、Microsoft も積極的にサポートしています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ダウンロード =&lt;br /&gt;
&lt;br /&gt;
* Windows 10: https://www.microsoft.com/en-us/download/details.aspx?id=45520&lt;br /&gt;
&lt;br /&gt;
* Windows 8.1: http://www.microsoft.com/en-us/download/details.aspx?id=39296&lt;br /&gt;
&lt;br /&gt;
* Windows 8: http://www.microsoft.com/en-us/download/details.aspx?id=28972&lt;br /&gt;
&lt;br /&gt;
* Windows 7: http://www.microsoft.com/en-us/download/details.aspx?id=7887&lt;br /&gt;
&lt;br /&gt;
* Windows Vista: http://www.microsoft.com/en-us/download/details.aspx?id=21090&lt;br /&gt;
&lt;br /&gt;
Windows Server オペレーティングシステムには、Microsoftリモートサーバー管理ツール (RSAT)が含まれています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= インストール =&lt;br /&gt;
&lt;br /&gt;
== Windows 8 and later ==&lt;br /&gt;
&lt;br /&gt;
* Start the downloaded installer and follow the instructions. All features are installed automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Windows Vista and 7 ==&lt;br /&gt;
&lt;br /&gt;
* Start the downloaded installer and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
* Click &amp;lt;code&amp;gt;Start&amp;lt;/code&amp;gt;, enter &amp;lt;code&amp;gt;Programs and Features&amp;lt;/code&amp;gt; into the search field and start the application.&lt;br /&gt;
&lt;br /&gt;
* Select the features to install:&lt;br /&gt;
: The following are the recommended features to administer a Samba Active Directory installation:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Group Policy Management Tools&lt;br /&gt;
|Provides the Group Policy MMC Snap-ins: Management Tool, Management Editor and Starter GPO Editor.&lt;br /&gt;
|-&lt;br /&gt;
|Active Directory Module for Windows PowerShell&lt;br /&gt;
|Optional. Enables Active Directory (AD) PowerShell cmdlets.&lt;br /&gt;
|-&lt;br /&gt;
|AD DS Tools&lt;br /&gt;
|Provides the &amp;lt;code&amp;gt;Active Directory Users and Computers&amp;lt;/code&amp;gt; (ADUC) and &amp;lt;code&amp;gt;Active Directory Sites and Services&amp;lt;/code&amp;gt; MMC Snap-in.&lt;br /&gt;
|-&lt;br /&gt;
|Server for NIS Tools&lt;br /&gt;
|Adds the &amp;lt;code&amp;gt;UNIX Attributes&amp;lt;/code&amp;gt; tab to ADUC objects properties. It enables you to configure [[Idmap_config_ad|RFC2307 attributes]].&lt;br /&gt;
|-&lt;br /&gt;
|DNS Server tools&lt;br /&gt;
|DNS MMC Snap-in for remote DNS management.&lt;br /&gt;
|-&lt;br /&gt;
|Remote Desktop Services Tool&lt;br /&gt;
|Optional. Adds the &amp;lt;code&amp;gt;Remote Desktop Services Profile&amp;lt;/code&amp;gt; tab to the ADUC user object&#039;s properties and installs the &amp;lt;code&amp;gt;RDP server administration&amp;lt;/code&amp;gt; MMC Snap-in. Install this feature to configure remote desktop protocol (RDP) settings in ADUC.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Click &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt; to install the features.&lt;br /&gt;
&lt;br /&gt;
You can find the installed tools in the &amp;lt;code&amp;gt;Administrative tools&amp;lt;/code&amp;gt; menu in your start menu. Alternatively, add the Snap-ins in the MMC using the &amp;lt;code&amp;gt;File&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;Add/Remove Snap-in&amp;lt;/code&amp;gt; menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Windows Server ==&lt;br /&gt;
&lt;br /&gt;
* Start the &amp;lt;code&amp;gt;Server Manager&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* On Windows Server 2012, 2012 R2, and 2016:&lt;br /&gt;
:* Click &amp;lt;code&amp;gt;Add roles and features&amp;lt;/code&amp;gt;.&lt;br /&gt;
:* Select &amp;lt;code&amp;gt;Role-based or feature-based installation&amp;lt;/code&amp;gt;.&lt;br /&gt;
:* Select the host on which to install the features.&lt;br /&gt;
:* Click &amp;lt;code&amp;gt;Next&amp;lt;/code&amp;gt; on the &amp;lt;code&amp;gt;Roles&amp;lt;/code&amp;gt; page.&lt;br /&gt;
&lt;br /&gt;
* On Windows Server 2008 and 2008 R2:&lt;br /&gt;
:*Select &amp;lt;code&amp;gt;Features&amp;lt;/code&amp;gt; in the navigation tree and click &amp;lt;code&amp;gt;Add Features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Select the features to install:&lt;br /&gt;
: The following are the recommended features to administer a Samba Active Directory installation:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Group Policy Management&lt;br /&gt;
|Provides the Group Policy MMC Snap-ins: Management Tool, Management Editor and Starter GPO Editor.&lt;br /&gt;
|-&lt;br /&gt;
|AD DS Snap-Ins and Command-Line Tools&lt;br /&gt;
|Optional. Provides the &amp;lt;code&amp;gt;Active Directory Users and Computers&amp;lt;/code&amp;gt; (ADUC) and &amp;lt;code&amp;gt;Active Directory Sites and Services&amp;lt;/code&amp;gt; MMC Snap-in.&lt;br /&gt;
|-&lt;br /&gt;
|Server for NIS Tools&lt;br /&gt;
|Adds the &amp;lt;code&amp;gt;UNIX Attributes&amp;lt;/code&amp;gt; tab to ADUC objects properties. It enables you to configure [[Idmap_config_ad|RFC2307 attributes]].&amp;lt;br /&amp;gt;This feature is not supported in Windows Server 2016. For details, see [[#Missing_.22Unix_Attributes.22_tab_in_ADUC_on_Windows_10|Missing &amp;quot;Unix Attributes&amp;quot; tab in ADUC on Windows 10 and Windows Server 2016]].&lt;br /&gt;
|-&lt;br /&gt;
|Active Directory Module for Windows PowerShell&lt;br /&gt;
|Enables Active Directory (AD) PowerShell cmdlets.&lt;br /&gt;
|-&lt;br /&gt;
|DNS Server tools&lt;br /&gt;
|DNS MMC Snap-in for remote DNS management.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Enabling the &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt; Mode =&lt;br /&gt;
&lt;br /&gt;
Many Remote Server Administration Tools (RSAT) provide additional features and options after enabling the &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt; option. To activate:&lt;br /&gt;
&lt;br /&gt;
* Select the root of the navigation tree on the left side.&lt;br /&gt;
&lt;br /&gt;
* Open the &amp;lt;code&amp;gt;View&amp;lt;/code&amp;gt; menu.&lt;br /&gt;
&lt;br /&gt;
* Select &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:[[Image:ADUC_Enabling_Advanced_Features.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Missing &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab in ADUC on Windows 10 and Windows Server 2016 =&lt;br /&gt;
&lt;br /&gt;
Windows 10 and Windows Server 2016 do not support the &amp;lt;code&amp;gt;Server for NIS Tools&amp;lt;/code&amp;gt; option. Without this feature, the Active Directory User and Computer (ADUC) console does not show the &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab on user and group objects. To work around this problem, set the attributes in Active Directory (AD) manually or use a different Windows operating system.&lt;br /&gt;
&lt;br /&gt;
To manually set the attributes, use the &amp;lt;code&amp;gt;Attributes&amp;lt;/code&amp;gt; tab on user and group object&#039;s properties. Note that this tab is only visible if you enabled the advanced features in ADUC. For further details, see [[#Enabling_the_Advanced_Features_Mode|Enabling the &amp;quot;Advanced Features&amp;quot; Mode]].&lt;br /&gt;
&lt;br /&gt;
The fields from the &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab are mapped to the following AD attributes of the object:&lt;br /&gt;
&lt;br /&gt;
* Users:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field on the &amp;quot;Unix Attributes&amp;quot; tab&lt;br /&gt;
!Active Directory attribute&lt;br /&gt;
|-&lt;br /&gt;
|NIS Domain&lt;br /&gt;
|msSFU30NisDomain&lt;br /&gt;
|-&lt;br /&gt;
|UID&lt;br /&gt;
|uidNumber&lt;br /&gt;
|-&lt;br /&gt;
|Logon Shell&lt;br /&gt;
|loginShell&lt;br /&gt;
|-&lt;br /&gt;
|Home Directory&lt;br /&gt;
|unixHomeDirectory&lt;br /&gt;
|-&lt;br /&gt;
|Primary group name/GID&lt;br /&gt;
|primaryGroupID&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Groups:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field on the &amp;quot;Unix Attributes&amp;quot; tab&lt;br /&gt;
!Active Directory attribute&lt;br /&gt;
|-&lt;br /&gt;
|NIS Domain&lt;br /&gt;
|msSFU30NisDomain&lt;br /&gt;
|-&lt;br /&gt;
|GID (Group ID)&lt;br /&gt;
|gidNumber&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = note&lt;br /&gt;
| text = If you set user IDs (UID) and group IDs (GID) manually, you must also track the last used UID and GID numbers manually.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Reporting Problems and Incompatibilities =&lt;br /&gt;
&lt;br /&gt;
To report problems or incompatibilities when using the Microsoft Remote Server Administration Tools (RSAT), see [[Bug_Reporting|Bug Reporting]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;br /&gt;
[[Category:User Management]]&lt;br /&gt;
[[Category:Group Policy Management]]&lt;br /&gt;
[[Category:DNS]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=RSAT%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB&amp;diff=10061</id>
		<title>RSATのインストール</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=RSAT%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB&amp;diff=10061"/>
		<updated>2019-05-14T08:01:21Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: ページの作成:「= Introduction =  To administer Active Directory (AD) from Windows, use the Microsoft Remote Server Administration Tools (RSAT). The tools are available for all platforms…」&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To administer Active Directory (AD) from Windows, use the Microsoft Remote Server Administration Tools (RSAT). The tools are available for all platforms, Microsoft actively supports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
&lt;br /&gt;
* Windows 10: https://www.microsoft.com/en-us/download/details.aspx?id=45520&lt;br /&gt;
&lt;br /&gt;
* Windows 8.1: http://www.microsoft.com/en-us/download/details.aspx?id=39296&lt;br /&gt;
&lt;br /&gt;
* Windows 8: http://www.microsoft.com/en-us/download/details.aspx?id=28972&lt;br /&gt;
&lt;br /&gt;
* Windows 7: http://www.microsoft.com/en-us/download/details.aspx?id=7887&lt;br /&gt;
&lt;br /&gt;
* Windows Vista: http://www.microsoft.com/en-us/download/details.aspx?id=21090&lt;br /&gt;
&lt;br /&gt;
In Windows Server operating systems, the Microsoft Remote Server Administration Tools (RSAT) are included.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
== Windows 8 and later ==&lt;br /&gt;
&lt;br /&gt;
* Start the downloaded installer and follow the instructions. All features are installed automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Windows Vista and 7 ==&lt;br /&gt;
&lt;br /&gt;
* Start the downloaded installer and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
* Click &amp;lt;code&amp;gt;Start&amp;lt;/code&amp;gt;, enter &amp;lt;code&amp;gt;Programs and Features&amp;lt;/code&amp;gt; into the search field and start the application.&lt;br /&gt;
&lt;br /&gt;
* Select the features to install:&lt;br /&gt;
: The following are the recommended features to administer a Samba Active Directory installation:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Group Policy Management Tools&lt;br /&gt;
|Provides the Group Policy MMC Snap-ins: Management Tool, Management Editor and Starter GPO Editor.&lt;br /&gt;
|-&lt;br /&gt;
|Active Directory Module for Windows PowerShell&lt;br /&gt;
|Optional. Enables Active Directory (AD) PowerShell cmdlets.&lt;br /&gt;
|-&lt;br /&gt;
|AD DS Tools&lt;br /&gt;
|Provides the &amp;lt;code&amp;gt;Active Directory Users and Computers&amp;lt;/code&amp;gt; (ADUC) and &amp;lt;code&amp;gt;Active Directory Sites and Services&amp;lt;/code&amp;gt; MMC Snap-in.&lt;br /&gt;
|-&lt;br /&gt;
|Server for NIS Tools&lt;br /&gt;
|Adds the &amp;lt;code&amp;gt;UNIX Attributes&amp;lt;/code&amp;gt; tab to ADUC objects properties. It enables you to configure [[Idmap_config_ad|RFC2307 attributes]].&lt;br /&gt;
|-&lt;br /&gt;
|DNS Server tools&lt;br /&gt;
|DNS MMC Snap-in for remote DNS management.&lt;br /&gt;
|-&lt;br /&gt;
|Remote Desktop Services Tool&lt;br /&gt;
|Optional. Adds the &amp;lt;code&amp;gt;Remote Desktop Services Profile&amp;lt;/code&amp;gt; tab to the ADUC user object&#039;s properties and installs the &amp;lt;code&amp;gt;RDP server administration&amp;lt;/code&amp;gt; MMC Snap-in. Install this feature to configure remote desktop protocol (RDP) settings in ADUC.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Click &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt; to install the features.&lt;br /&gt;
&lt;br /&gt;
You can find the installed tools in the &amp;lt;code&amp;gt;Administrative tools&amp;lt;/code&amp;gt; menu in your start menu. Alternatively, add the Snap-ins in the MMC using the &amp;lt;code&amp;gt;File&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;Add/Remove Snap-in&amp;lt;/code&amp;gt; menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Windows Server ==&lt;br /&gt;
&lt;br /&gt;
* Start the &amp;lt;code&amp;gt;Server Manager&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* On Windows Server 2012, 2012 R2, and 2016:&lt;br /&gt;
:* Click &amp;lt;code&amp;gt;Add roles and features&amp;lt;/code&amp;gt;.&lt;br /&gt;
:* Select &amp;lt;code&amp;gt;Role-based or feature-based installation&amp;lt;/code&amp;gt;.&lt;br /&gt;
:* Select the host on which to install the features.&lt;br /&gt;
:* Click &amp;lt;code&amp;gt;Next&amp;lt;/code&amp;gt; on the &amp;lt;code&amp;gt;Roles&amp;lt;/code&amp;gt; page.&lt;br /&gt;
&lt;br /&gt;
* On Windows Server 2008 and 2008 R2:&lt;br /&gt;
:*Select &amp;lt;code&amp;gt;Features&amp;lt;/code&amp;gt; in the navigation tree and click &amp;lt;code&amp;gt;Add Features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Select the features to install:&lt;br /&gt;
: The following are the recommended features to administer a Samba Active Directory installation:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|Group Policy Management&lt;br /&gt;
|Provides the Group Policy MMC Snap-ins: Management Tool, Management Editor and Starter GPO Editor.&lt;br /&gt;
|-&lt;br /&gt;
|AD DS Snap-Ins and Command-Line Tools&lt;br /&gt;
|Optional. Provides the &amp;lt;code&amp;gt;Active Directory Users and Computers&amp;lt;/code&amp;gt; (ADUC) and &amp;lt;code&amp;gt;Active Directory Sites and Services&amp;lt;/code&amp;gt; MMC Snap-in.&lt;br /&gt;
|-&lt;br /&gt;
|Server for NIS Tools&lt;br /&gt;
|Adds the &amp;lt;code&amp;gt;UNIX Attributes&amp;lt;/code&amp;gt; tab to ADUC objects properties. It enables you to configure [[Idmap_config_ad|RFC2307 attributes]].&amp;lt;br /&amp;gt;This feature is not supported in Windows Server 2016. For details, see [[#Missing_.22Unix_Attributes.22_tab_in_ADUC_on_Windows_10|Missing &amp;quot;Unix Attributes&amp;quot; tab in ADUC on Windows 10 and Windows Server 2016]].&lt;br /&gt;
|-&lt;br /&gt;
|Active Directory Module for Windows PowerShell&lt;br /&gt;
|Enables Active Directory (AD) PowerShell cmdlets.&lt;br /&gt;
|-&lt;br /&gt;
|DNS Server tools&lt;br /&gt;
|DNS MMC Snap-in for remote DNS management.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Enabling the &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt; Mode =&lt;br /&gt;
&lt;br /&gt;
Many Remote Server Administration Tools (RSAT) provide additional features and options after enabling the &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt; option. To activate:&lt;br /&gt;
&lt;br /&gt;
* Select the root of the navigation tree on the left side.&lt;br /&gt;
&lt;br /&gt;
* Open the &amp;lt;code&amp;gt;View&amp;lt;/code&amp;gt; menu.&lt;br /&gt;
&lt;br /&gt;
* Select &amp;lt;code&amp;gt;Advanced Features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:[[Image:ADUC_Enabling_Advanced_Features.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Missing &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab in ADUC on Windows 10 and Windows Server 2016 =&lt;br /&gt;
&lt;br /&gt;
Windows 10 and Windows Server 2016 do not support the &amp;lt;code&amp;gt;Server for NIS Tools&amp;lt;/code&amp;gt; option. Without this feature, the Active Directory User and Computer (ADUC) console does not show the &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab on user and group objects. To work around this problem, set the attributes in Active Directory (AD) manually or use a different Windows operating system.&lt;br /&gt;
&lt;br /&gt;
To manually set the attributes, use the &amp;lt;code&amp;gt;Attributes&amp;lt;/code&amp;gt; tab on user and group object&#039;s properties. Note that this tab is only visible if you enabled the advanced features in ADUC. For further details, see [[#Enabling_the_Advanced_Features_Mode|Enabling the &amp;quot;Advanced Features&amp;quot; Mode]].&lt;br /&gt;
&lt;br /&gt;
The fields from the &amp;lt;code&amp;gt;Unix Attributes&amp;lt;/code&amp;gt; tab are mapped to the following AD attributes of the object:&lt;br /&gt;
&lt;br /&gt;
* Users:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field on the &amp;quot;Unix Attributes&amp;quot; tab&lt;br /&gt;
!Active Directory attribute&lt;br /&gt;
|-&lt;br /&gt;
|NIS Domain&lt;br /&gt;
|msSFU30NisDomain&lt;br /&gt;
|-&lt;br /&gt;
|UID&lt;br /&gt;
|uidNumber&lt;br /&gt;
|-&lt;br /&gt;
|Logon Shell&lt;br /&gt;
|loginShell&lt;br /&gt;
|-&lt;br /&gt;
|Home Directory&lt;br /&gt;
|unixHomeDirectory&lt;br /&gt;
|-&lt;br /&gt;
|Primary group name/GID&lt;br /&gt;
|primaryGroupID&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Groups:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field on the &amp;quot;Unix Attributes&amp;quot; tab&lt;br /&gt;
!Active Directory attribute&lt;br /&gt;
|-&lt;br /&gt;
|NIS Domain&lt;br /&gt;
|msSFU30NisDomain&lt;br /&gt;
|-&lt;br /&gt;
|GID (Group ID)&lt;br /&gt;
|gidNumber&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = note&lt;br /&gt;
| text = If you set user IDs (UID) and group IDs (GID) manually, you must also track the last used UID and GID numbers manually.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Reporting Problems and Incompatibilities =&lt;br /&gt;
&lt;br /&gt;
To report problems or incompatibilities when using the Microsoft Remote Server Administration Tools (RSAT), see [[Bug_Reporting|Bug Reporting]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;br /&gt;
[[Category:User Management]]&lt;br /&gt;
[[Category:Group Policy Management]]&lt;br /&gt;
[[Category:DNS]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10060</id>
		<title>Samba AD DCのバックアップとリストア</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10060"/>
		<updated>2019-03-12T15:35:40Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = このページではSamba v4.9以降でバックアップを作成する方法について説明します。Samba v4.0-v4.8でのバックアップについては、[[Sambaバックアップスクリプトを使用する|こちら]]を参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 概要 ==&lt;br /&gt;
&lt;br /&gt;
Sambaバックアップは、万が一ドメインの壊滅的な障害が発生した場合にSambaネットワークを復旧する方法を提供します。&lt;br /&gt;
&lt;br /&gt;
バックアップにはいくつかの異なる種類があり、それらはさまざまな方法で機能し、さまざまなことを実現します:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Online&#039;&#039;&#039;  これは実行中のDCのデータベースのクローンを取得します。機能的には新しいDCをネットワークに参加させるのに似ています。&lt;br /&gt;
* &#039;&#039;&#039;Offline&#039;&#039;&#039; (あるいは &#039;local&#039;)  Sambaファイルがディスク上に表示されるときにこれをバックアップします。これには、この特定のDCにローカルで、オンラインバックアップには含まれていないレプリケーションメタデータが含まれます。DCがオフラインのとき（つまり、sambaプロセスが実際に実行されていないとき）にもバックアップファイルを作成できます。This backs up the Samba files as they appear on disk. This includes replication meta-data that&#039;s local to this particular DC and which is not included in online backups. It can also create a backup file when the DC is offline (i.e. the &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; process is not actually running). &lt;br /&gt;
* &#039;&#039;&#039;Rename&#039;&#039;&#039;. これにより、ドメインの名前が変更されたバックアップファイルが作成されます。これは一時的な置き換えにすぎません。&lt;br /&gt;
&lt;br /&gt;
これらの異なる種類のバックアップには、いくつかの共通点があります。バックアップはすべて &#039;samba-tool domain backup&#039;コマンドの変種を使用して作成されます。各コマンドは、（特定のDCに基づく）ドメインのバックアップ全体を含む.tar.bz2バックアップファイルを作成します。バックアップファイルは、 &#039;samba-tool domain backup restore&#039;コマンドを使用してドメインを復元するために使用できます。&lt;br /&gt;
These different types of backup have several things in common. The backups are all produced using a variant of the &#039;samba-tool domain backup&#039; command. Each command creates a .tar.bz2 backup-file which contains an entire backup of the domain (based on a given DC). The backup-file can then be used to restore the domain using the &#039;samba-tool domain backup restore&#039; command.&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = バックアップファイルはあなたのドメインのバックアップであり、あなたのDCではないことに注意してください。バックアップファイルを復元すると、ドメインの情報を含むまったく新しいDCが作成されます。後続のDCを復元するには、復元したDCに新しい新しいDCを結合する必要があります。&lt;br /&gt;
Note that the backup-file is a backup of your &#039;&#039;domain&#039;&#039;, not your &#039;&#039;DC&#039;&#039;. Restoring the backup-file will create a brand new DC with your domain&#039;s information. To restore subsequent DCs you must then [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|join]] fresh new DCs to the restored DC.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== So which backup should I use? ==&lt;br /&gt;
&lt;br /&gt;
This is a difficult question to answer, as it somewhat involves predicting how your Samba domain will fail. It also depends on how you plan to react to the failure. By creating a backup, you may be trying to achieve one of several different objectives:&lt;br /&gt;
&lt;br /&gt;
* Provide temporary replacment DC(s), which will buy you time while you troubleshoot and fix the problems on your original Samba network.&lt;br /&gt;
* Provide a long-term replacement for your domain, i.e. you plan to completely discard your failed domain and rollback to the last backup taken.&lt;br /&gt;
* Provide forensics on why the domain failure occurred in the first place, e.g. if a database corruption occurred, what factors may have led to the problem?&lt;br /&gt;
* Provide a &#039;good working state&#039; database that can be used as a guide for repairing and recovering deleted or corrupted objects in the production database.&lt;br /&gt;
&lt;br /&gt;
The rename backup works best for providing a temporary replacement domain, however, it is no good as a long-term replacement for the domain. Normally you can&#039;t run restored DCs and troubleshoot the failed domain DCs at the same time, because both will be using the same domain name (which will cause even more wild and weird problems to appear in your network). However, because the renamed backup is using a different domain name, it means you can safely run both the restored domain and the original domain in parallel.&lt;br /&gt;
&lt;br /&gt;
The online backup works best for providing a long-term replacement for your domain. It can be used as a temporary replacement, but you cannot easily troubleshoot the failed domain DCs at the same time. Investigating the reason behind the failure of a Samba domain could be time-consuming and technically complex work. If, in the event of a catastrophic domain failure, you don&#039;t intend to investigate the problem and just want to revert back to a older copy of a working domain, then this is the best option for you.&lt;br /&gt;
&lt;br /&gt;
The offline backup works best for forensics purposes, as it contains additional data that is not normally replicated. It can also be quicker to run an offline backup for a large domain, as you don&#039;t have the extra overhead of sending the database over the network and re-writing it to disk. However, note that the offline backup-file contains all the sensitive/secret information for your entire domain, so you still may not be able to share this backed-up information easily with Samba developers or mailing-lists. Also note that because the backup is copying the actual database on disk, there is potentially more chance that a corruption in the database is copied through to the backup.&lt;br /&gt;
&lt;br /&gt;
If you want to create multiple different types of backups, note that the details of the backup are saved in a &#039;backup.txt&#039; file within the backup-file itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing the backup restoration ==&lt;br /&gt;
&lt;br /&gt;
The often overlooked step in any disaster recovery plan is testing that your recovery system actually works before you need to put it into practice. Creating the backup-file is not much good if &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; fails to start up on your restored DC.&lt;br /&gt;
&lt;br /&gt;
Note that the backup/restore commands are new to Samba v4.9, and there may be something specific to your network which means they don&#039;t work as well as intended. It&#039;s better to find any problems now (and report them to the Samba mailing-list), rather than in an emergency.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, testing a Samba backup is hard to do. Because the online and offline backups use the exact same domain information as your production network, it is not safe to run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on a restored backup - the restored DC will interfere with your production network traffic.&lt;br /&gt;
&lt;br /&gt;
Here are a few options to help you gain confidence that your Samba backup will actually be useful.&lt;br /&gt;
* If you&#039;re generating a &#039;rename&#039; backup, then it&#039;s always safe to restore the backup-file onto a new DC and start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on it. So you can always sanity-check that your rename backup works successfully. A rename backup is quite similar to an online backup, so if your rename backup works, then you can have some confidence that your online backup would probably work too.&lt;br /&gt;
* It&#039;s always safe to restore the backup-file to disk, as long as you don&#039;t actually start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored database. You could then use tools like ldbsearch (by specifying the local filepath of the database on disk) to sanity-check database objects were backed up correctly.&lt;br /&gt;
* If you just want to get a better feel for what the various backup options do, one option is to [[create a samba lab-domain]], and then create and restore online/offline backups within the lab domain itself.&lt;br /&gt;
* Another option is configure your network switches to &#039;&#039;completely&#039;&#039; isolate the restored DC from the rest of your Samba network, although in practice this proves quite tricky to get right.&lt;br /&gt;
&lt;br /&gt;
Note that the backup tool creates a &#039;warts and all&#039; copy of the domain database. If you don&#039;t run &amp;lt;code&amp;gt;samba-tool dbcheck&amp;lt;/code&amp;gt; over your Samba database regularly, then it&#039;s worth getting into the habit, especially before you generate a new backup. Otherwise, any problems in your database will persist right through a backup and restore of your domain. Dbcheck will report any obvious problems that exist in your database, and provides a &#039;--fix&#039; option that will resolve the problems for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Online DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create an online backup, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup online --targetdir=&amp;lt;output-dir&amp;gt; --server=&amp;lt;DC-server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command can be run locally on the DC or remotely. If running the command remotely, you may want to specify a &amp;lt;code&amp;gt;--configfile&amp;lt;/code&amp;gt; option so that the correct smb.conf settings get included in the backup.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Offline/local DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create a offline backup, login on the DC you&#039;re backing up, and simply specify the target-directory location to write the backup-file to. E.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup offline --targetdir=&amp;lt;output-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that despite this option&#039;s name, the DC does not actually need to be offline when running this command. The tool is simply backing up the local files and it has sufficient locking in place to ensure the backup is generated safely.&lt;br /&gt;
&lt;br /&gt;
Note that while the other backup commands are available from Samba v4.9 onwards, the offline command is not included until the subsequent Samba release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Domain rename backup ==&lt;br /&gt;
&lt;br /&gt;
For more details on creating a rename backup, see [[Domain rename tool]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Untarring backups ==&lt;br /&gt;
&lt;br /&gt;
If you simply want to use the backup for forensic purposes (i.e. interrogating the details of specific database objects in a &#039;good&#039; state), then it&#039;s safe to just untar the backup-file and query the database directly on disk. Note that you cannot run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on an untarred backup - you &#039;&#039;must&#039;&#039; use the restore command to do this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the domain ==&lt;br /&gt;
&lt;br /&gt;
In the event of a catastrophic domain failure, to restore the domain from backup-file you would do the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stop &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on &#039;&#039;all&#039;&#039; the old DCs. (Unless you&#039;re using a renamed backup, in which case you can skip this step).&lt;br /&gt;
&amp;lt;li&amp;gt; Run the &#039;samba-tool domain backup restore&#039; command to restore the domain database on a single new DC. See below for more details.&lt;br /&gt;
&amp;lt;li&amp;gt; Start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the new DC.&lt;br /&gt;
&amp;lt;li&amp;gt; Re-add the old DCs back to the network by [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|joining]] them to the restored DC, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;samba-tool domain join &amp;lt;dns-realm&amp;gt; DC --server=&amp;lt;restored-dc&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; If you&#039;re using a renamed backup, you would then need to re-configure your network appliances so that traffic is redirected to the restored domain, instead of the failed/original domain.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is recovering the &#039;&#039;entire domain&#039;&#039;, not a specific DC. The &#039;samba-tool domain backup restore&#039; step is only done once, which re-creates the domain on a single DC. All old DCs must then be re-joined to the restored DC, in order to rejoin the domain.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the backup-file ==&lt;br /&gt;
&lt;br /&gt;
The step to restore a backup is similar to the &#039;domain provision&#039; you did back when you first setup your Samba network, except this time the backup contains all the database objects you&#039;ve added since then. Similar to doing a provision, you need to specify a new DC when you run the restore command. This new DC &#039;&#039;&#039;&#039;&#039;must not&#039;&#039;&#039;&#039;&#039; have existed previously in the Samba network. The restore command will look something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup restore --backup-file=&amp;lt;tar-file&amp;gt; --newservername=&amp;lt;DC-name&amp;gt; --targetdir=&amp;lt;new-samba-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the target-directory specified must be empty (or non-existent). This means it&#039;s not practical to restore the domain database back into the default installation location (e.g. &amp;lt;tt&amp;gt;/usr/local/samba&amp;lt;/tt&amp;gt;). Instead, we recommend that you restore the domain database into a different targetdir, and then use the &#039;-s&#039; (or &#039;--configfile&#039;) option when running &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;samba -s &amp;lt;targetdir&amp;gt;/etc/smb.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying the restored smb.conf will mean that Samba will use the database files in the correct location. &lt;br /&gt;
&lt;br /&gt;
The restored DC will be added to the &#039;Default-First-Site-Name&#039; site. This site will be created in the restored DB if it does not already exist. You can specify an alternative site to add the restored DC to using the &amp;lt;tt&amp;gt;--site&amp;lt;/tt&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
Before starting &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored DC, you should double-check the restored smb.conf settings are correct. It may also be helpful to run &amp;lt;code&amp;gt;samba_dnsupdate&amp;lt;/code&amp;gt; (although this still gets run automatically when you start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Recommended strategy ==&lt;br /&gt;
&lt;br /&gt;
Restoring the backup-file has a couple of minor annoyances:&lt;br /&gt;
* Having to use a different directory to the default installation location.&lt;br /&gt;
* Having to specify a different DC server-name to what was previously in your network.&lt;br /&gt;
&lt;br /&gt;
The simple way to minimize these annoyances is to use a temporary server (or VM) for your restored DC. i.e.&lt;br /&gt;
* Restore the backup-file onto the temporary DC and start Samba.&lt;br /&gt;
* Rejoin the original DCs to the temporary DC one at a time. You can re-use the same server-name and default installation location during the join.&lt;br /&gt;
* Once all the original DCs have joined the restored domain, you can remove the temporary DC (i.e. using &#039;samba-tool domain demote&#039;). Your network of DCs should now be exactly the same as it was previously (except hopefully now in a valid working state!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
Note that if the backup or restore commands unexpectedly throw an error, they may leave behind a temporary directory in the &amp;lt;code&amp;gt;--targetdir&amp;lt;/code&amp;gt; you specified. These may help to provide clues as to why the failure occurred. If you&#039;re running the restore command, then you will need to clean these up manually before re-running the command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating Backups ==&lt;br /&gt;
&lt;br /&gt;
* Note that you should run the backup as root. Online backups can actually succeed as a non-root user, but it will cause you headaches later when you try to restore it.&lt;br /&gt;
&lt;br /&gt;
* For &#039;online&#039; or &#039;rename&#039; backups, sanity-check that the credentials and server details you&#039;re using are correct. E.g. try:&lt;br /&gt;
&amp;lt;pre&amp;gt;ldbsearch -H ldap://&amp;lt;server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Try increasing the debug-level to see if that tells you more about the failure. E.g. add the &amp;lt;code&amp;gt;--debug=3&amp;lt;/code&amp;gt; option to the command.&lt;br /&gt;
&lt;br /&gt;
* The &#039;online&#039; and &#039;rename&#039; commands work in a very similar way to a joining a DC. If joining a DC is known to fail on your network, then these commands are unlikely to work either. If you see the &#039;Committing SAM database&#039; and &#039;Cloned domain &amp;lt;domain&amp;gt;&#039; messages, then the join-like part of the backup has likely succeeded.&lt;br /&gt;
&lt;br /&gt;
* The backup tools do not work against a Windows DC (mostly just backing up the sysvol files fails). If you have a mixed DC domain, then backup a Samba DC rather than a Windows DC.&lt;br /&gt;
&lt;br /&gt;
* When doing an &#039;online&#039; or &#039;rename&#039; backup, samba-tool connects to DC over SMB to backup the sysvol share files (and their NTACLs). Depending on the &#039;min/max protocol&#039; smb.conf settings on your client/server, this SMB connection may fail, producing an error like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Cloned domain BACKUPDOMAIN (SID S-1-5-21-2948945078-3345239999-1381142759)&lt;br /&gt;
smbXcli_negprot: SMB signing is mandatory and the selected protocol level doesn&#039;t support it.&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225506, &#039;{Access Denied} A process has requested access to an object but has not been granted those access rights.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 183, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 248, in run&lt;br /&gt;
    smb_conn = smb.SMB(server, &amp;quot;sysvol&amp;quot;, lp=lp, creds=creds, sign=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This error message is a little misleading. The problem is the backup tool only works with SMBv1 protocols, and recent CVEs have recommended disabling SMBv1 on your DCs. Therefore the client and server cannot negotiate a compatible protocol, and the SMB connection can&#039;t be established. Bug #13621 is currently tracking this issue. The current workaround is to either do an &#039;offline&#039; backup locally on the DC (which doesn&#039;t require an SMB connection), or to temporarily re-enable SMBv1 while the backup is made.&lt;br /&gt;
&lt;br /&gt;
* An unusual corner-case is where you try to backup a brand new DC, before it&#039;s allocated a RID, which results in an error like below. Most users would be unlikely to ever see this, but if you do, the solution is to add a temporary user (i.e. &amp;lt;tt&amp;gt;samba-tool user create&amp;lt;/tt&amp;gt;), just to force a RID allocation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
samba-tool domain backup offline --targetdir=/home/ubuntu/backup&amp;lt;ldb result&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.IndexError&#039;&amp;gt;): uncaught exception - list index out of range&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 941, in run&lt;br /&gt;
    sid = get_sid_for_restore(samdb)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 80, in get_sid_for_restore&lt;br /&gt;
    rid = int(res[0].get(&#039;rIDNextRID&#039;)[0])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Note that offline backups require the lmdb-utils package installed, otherwise it throws an exception trying to run mdb_copy(). E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.OSError&#039;&amp;gt;): uncaught exception - [Errno 2] No such &lt;br /&gt;
file or directory                                                                              &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run                                                                                                           &lt;br /&gt;
    return self.run(*args, **kwargs)                                                                                                                                      &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 982, in run                                                                                                       &lt;br /&gt;
    self.backup_smb_dbs(paths.private_dir, samdb, lp, logger)                                                                                                             &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 907, in backup_smb_dbs&lt;br /&gt;
    copy_function(sam_file)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 866, in &lt;br /&gt;
offline_mdb_copy&lt;br /&gt;
    mdb_copy(path, path + self.backup_ext)&lt;br /&gt;
  File &amp;quot;bin/python/samba/mdb_util.py&amp;quot;, line 35, in mdb_copy&lt;br /&gt;
    status = subprocess.check_call(mdb_copy_cmd, close_fds=True, shell=False)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 185, in check_call&lt;br /&gt;
    retcode = call(*popenargs, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 172, in call&lt;br /&gt;
    return Popen(*popenargs, **kwargs).wait()&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 394, in __init__&lt;br /&gt;
    errread, errwrite)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 1047, in _execute_child&lt;br /&gt;
    raise child_exception&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Running the backup against a Windows DC generally fails during the backup of the sysvol share. You may see an error like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INFO 2019-01-15 15:29:11,850 pid:208088 bin/python/samba/join.py #1554: Cloned domain WINDOWS2012R2 (SID S-1-5-21-886655096-618523297-2770022155)&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225539, &#039;A file cannot be opened because the share access flags are incompatible.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 264, in run&lt;br /&gt;
    backup_online(smb_conn, sysvol_tar, remote_sam.get_domain_sid())&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 512, in backup_online&lt;br /&gt;
    ntacl_sddl_str = smb_helper.get_acl(r_name, as_sddl=True)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 334, in get_acl&lt;br /&gt;
    smb_path, SECURITY_SECINFO_FLAGS, SECURITY_SEC_FLAGS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem seems to be accessing the DfsrPrivate\Deleted and DfsrPrivate\Installing folders.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring backups ==&lt;br /&gt;
&lt;br /&gt;
* The restore command needs to be run as root. Part of the backup process involves preserving and restoring the NTACLs of the sysvol files, and some of the file operations involved require root permissions. If you&#039;re not root, then you&#039;ll probably see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;ERROR(&amp;lt;type &#039;exceptions.TypeError&#039;&amp;gt;): uncaught exception - (1, &#039;Operation not permitted&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 520, in run&lt;br /&gt;
    backup_restore(sysvol_tar, dest_sysvol_dir, samdb, smbconf)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 589, in backup_restore&lt;br /&gt;
    ntacls_helper.setntacl(dst, ntacl_sddl_str)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 445, in setntacl&lt;br /&gt;
    return setntacl(self.lp, path, ntacl_sd, self.dom_sid)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 214, in setntacl&lt;br /&gt;
    ndr_pack(ntacl))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;--newservername&amp;lt;/code&amp;gt; you specify for the restored DC must not already exist in the original domain. Otherwise you&#039;ll see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adding CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com&lt;br /&gt;
ERROR(ldb): uncaught exception - Entry CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com already exists&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 439, in run&lt;br /&gt;
    ctx.join_add_objects(specified_sid=dom_sid(sid))&lt;br /&gt;
  File &amp;quot;bin/python/samba/join.py&amp;quot;, line 625, in join_add_objects&lt;br /&gt;
    ctx.samdb.add(rec, controls=controls)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If the backup command was run locally on the DC, then the backup-file should contain the DC&#039;s smb.conf. However, the smb.conf in the backup-file may contain &#039;interfaces&#039; configuration that doesn&#039;t match the IP addresses on the DC you&#039;re restoring on. If this happens, you&#039;ll get an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Looking up IPv4 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv4 address will be assigned&lt;br /&gt;
Looking up IPv6 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv6 address will be assigned&lt;br /&gt;
ERROR: Please specify a host-ip for the new server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You can avoid this problem by specifying a &amp;lt;code&amp;gt;--host-ip&amp;lt;/code&amp;gt; argument during the restore. This should only affect rename backups.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Starting samba ==&lt;br /&gt;
&lt;br /&gt;
If you ran the backup as a non-root user, the restore will still succeed, but you&#039;ll hit errors when you try to start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;. E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo samba -s /tmp/online4/etc/smb.conf -i -d 3&lt;br /&gt;
samba version 4.10.0pre1-DEVELOPERBUILD started.&lt;br /&gt;
Copyright Andrew Tridgell and the Samba Team 1992-2018&lt;br /&gt;
...&lt;br /&gt;
directory_create_or_exist_strict: invalid ownership on directory /tmp/restore/private/msg.sock&lt;br /&gt;
exit_daemon: STATUS=daemon failed to start: Samba failed to setup parent messaging, error code -1073741801&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You could &amp;lt;tt&amp;gt;chown&amp;lt;/tt&amp;gt; your way out of this, but it&#039;s a lot simpler just to run the backup command as root.&lt;br /&gt;
&lt;br /&gt;
[[Category:Backup]] [[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10059</id>
		<title>Samba AD DCのバックアップとリストア</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10059"/>
		<updated>2019-03-12T15:29:37Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = このページではSamba v4.9以降でバックアップを作成する方法について説明します。Samba v4.0-v4.8でのバックアップについては、[[Sambaバックアップスクリプトを使用する|こちら]]を参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Samba backups provide a way to recover your Samba network, in the unlikely event that a catastrophic failure of the domain occurs.&lt;br /&gt;
&lt;br /&gt;
There are a few different flavours of backup, which work in different ways and achieve different things:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Online&#039;&#039;&#039;. This takes a clone of a running DC&#039;s database. It&#039;s similar in functionality to joining a new DC to the network.&lt;br /&gt;
* &#039;&#039;&#039;Offline&#039;&#039;&#039; (or &#039;local&#039;). This backs up the Samba files as they appear on disk. This includes replication meta-data that&#039;s local to this particular DC and which is not included in online backups. It can also create a backup file when the DC is offline (i.e. the &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; process is not actually running). &lt;br /&gt;
* &#039;&#039;&#039;Rename&#039;&#039;&#039;. This produces a backup file with the domain renamed, and is intended as only a temporary replacement. &lt;br /&gt;
&lt;br /&gt;
These different types of backup have several things in common. The backups are all produced using a variant of the &#039;samba-tool domain backup&#039; command. Each command creates a .tar.bz2 backup-file which contains an entire backup of the domain (based on a given DC). The backup-file can then be used to restore the domain using the &#039;samba-tool domain backup restore&#039; command.&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is a backup of your &#039;&#039;domain&#039;&#039;, not your &#039;&#039;DC&#039;&#039;. Restoring the backup-file will create a brand new DC with your domain&#039;s information. To restore subsequent DCs you must then [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|join]] fresh new DCs to the restored DC.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== So which backup should I use? ==&lt;br /&gt;
&lt;br /&gt;
This is a difficult question to answer, as it somewhat involves predicting how your Samba domain will fail. It also depends on how you plan to react to the failure. By creating a backup, you may be trying to achieve one of several different objectives:&lt;br /&gt;
&lt;br /&gt;
* Provide temporary replacment DC(s), which will buy you time while you troubleshoot and fix the problems on your original Samba network.&lt;br /&gt;
* Provide a long-term replacement for your domain, i.e. you plan to completely discard your failed domain and rollback to the last backup taken.&lt;br /&gt;
* Provide forensics on why the domain failure occurred in the first place, e.g. if a database corruption occurred, what factors may have led to the problem?&lt;br /&gt;
* Provide a &#039;good working state&#039; database that can be used as a guide for repairing and recovering deleted or corrupted objects in the production database.&lt;br /&gt;
&lt;br /&gt;
The rename backup works best for providing a temporary replacement domain, however, it is no good as a long-term replacement for the domain. Normally you can&#039;t run restored DCs and troubleshoot the failed domain DCs at the same time, because both will be using the same domain name (which will cause even more wild and weird problems to appear in your network). However, because the renamed backup is using a different domain name, it means you can safely run both the restored domain and the original domain in parallel.&lt;br /&gt;
&lt;br /&gt;
The online backup works best for providing a long-term replacement for your domain. It can be used as a temporary replacement, but you cannot easily troubleshoot the failed domain DCs at the same time. Investigating the reason behind the failure of a Samba domain could be time-consuming and technically complex work. If, in the event of a catastrophic domain failure, you don&#039;t intend to investigate the problem and just want to revert back to a older copy of a working domain, then this is the best option for you.&lt;br /&gt;
&lt;br /&gt;
The offline backup works best for forensics purposes, as it contains additional data that is not normally replicated. It can also be quicker to run an offline backup for a large domain, as you don&#039;t have the extra overhead of sending the database over the network and re-writing it to disk. However, note that the offline backup-file contains all the sensitive/secret information for your entire domain, so you still may not be able to share this backed-up information easily with Samba developers or mailing-lists. Also note that because the backup is copying the actual database on disk, there is potentially more chance that a corruption in the database is copied through to the backup.&lt;br /&gt;
&lt;br /&gt;
If you want to create multiple different types of backups, note that the details of the backup are saved in a &#039;backup.txt&#039; file within the backup-file itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing the backup restoration ==&lt;br /&gt;
&lt;br /&gt;
The often overlooked step in any disaster recovery plan is testing that your recovery system actually works before you need to put it into practice. Creating the backup-file is not much good if &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; fails to start up on your restored DC.&lt;br /&gt;
&lt;br /&gt;
Note that the backup/restore commands are new to Samba v4.9, and there may be something specific to your network which means they don&#039;t work as well as intended. It&#039;s better to find any problems now (and report them to the Samba mailing-list), rather than in an emergency.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, testing a Samba backup is hard to do. Because the online and offline backups use the exact same domain information as your production network, it is not safe to run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on a restored backup - the restored DC will interfere with your production network traffic.&lt;br /&gt;
&lt;br /&gt;
Here are a few options to help you gain confidence that your Samba backup will actually be useful.&lt;br /&gt;
* If you&#039;re generating a &#039;rename&#039; backup, then it&#039;s always safe to restore the backup-file onto a new DC and start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on it. So you can always sanity-check that your rename backup works successfully. A rename backup is quite similar to an online backup, so if your rename backup works, then you can have some confidence that your online backup would probably work too.&lt;br /&gt;
* It&#039;s always safe to restore the backup-file to disk, as long as you don&#039;t actually start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored database. You could then use tools like ldbsearch (by specifying the local filepath of the database on disk) to sanity-check database objects were backed up correctly.&lt;br /&gt;
* If you just want to get a better feel for what the various backup options do, one option is to [[create a samba lab-domain]], and then create and restore online/offline backups within the lab domain itself.&lt;br /&gt;
* Another option is configure your network switches to &#039;&#039;completely&#039;&#039; isolate the restored DC from the rest of your Samba network, although in practice this proves quite tricky to get right.&lt;br /&gt;
&lt;br /&gt;
Note that the backup tool creates a &#039;warts and all&#039; copy of the domain database. If you don&#039;t run &amp;lt;code&amp;gt;samba-tool dbcheck&amp;lt;/code&amp;gt; over your Samba database regularly, then it&#039;s worth getting into the habit, especially before you generate a new backup. Otherwise, any problems in your database will persist right through a backup and restore of your domain. Dbcheck will report any obvious problems that exist in your database, and provides a &#039;--fix&#039; option that will resolve the problems for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Online DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create an online backup, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup online --targetdir=&amp;lt;output-dir&amp;gt; --server=&amp;lt;DC-server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command can be run locally on the DC or remotely. If running the command remotely, you may want to specify a &amp;lt;code&amp;gt;--configfile&amp;lt;/code&amp;gt; option so that the correct smb.conf settings get included in the backup.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Offline/local DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create a offline backup, login on the DC you&#039;re backing up, and simply specify the target-directory location to write the backup-file to. E.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup offline --targetdir=&amp;lt;output-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that despite this option&#039;s name, the DC does not actually need to be offline when running this command. The tool is simply backing up the local files and it has sufficient locking in place to ensure the backup is generated safely.&lt;br /&gt;
&lt;br /&gt;
Note that while the other backup commands are available from Samba v4.9 onwards, the offline command is not included until the subsequent Samba release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Domain rename backup ==&lt;br /&gt;
&lt;br /&gt;
For more details on creating a rename backup, see [[Domain rename tool]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Untarring backups ==&lt;br /&gt;
&lt;br /&gt;
If you simply want to use the backup for forensic purposes (i.e. interrogating the details of specific database objects in a &#039;good&#039; state), then it&#039;s safe to just untar the backup-file and query the database directly on disk. Note that you cannot run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on an untarred backup - you &#039;&#039;must&#039;&#039; use the restore command to do this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the domain ==&lt;br /&gt;
&lt;br /&gt;
In the event of a catastrophic domain failure, to restore the domain from backup-file you would do the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stop &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on &#039;&#039;all&#039;&#039; the old DCs. (Unless you&#039;re using a renamed backup, in which case you can skip this step).&lt;br /&gt;
&amp;lt;li&amp;gt; Run the &#039;samba-tool domain backup restore&#039; command to restore the domain database on a single new DC. See below for more details.&lt;br /&gt;
&amp;lt;li&amp;gt; Start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the new DC.&lt;br /&gt;
&amp;lt;li&amp;gt; Re-add the old DCs back to the network by [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|joining]] them to the restored DC, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;samba-tool domain join &amp;lt;dns-realm&amp;gt; DC --server=&amp;lt;restored-dc&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; If you&#039;re using a renamed backup, you would then need to re-configure your network appliances so that traffic is redirected to the restored domain, instead of the failed/original domain.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is recovering the &#039;&#039;entire domain&#039;&#039;, not a specific DC. The &#039;samba-tool domain backup restore&#039; step is only done once, which re-creates the domain on a single DC. All old DCs must then be re-joined to the restored DC, in order to rejoin the domain.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the backup-file ==&lt;br /&gt;
&lt;br /&gt;
The step to restore a backup is similar to the &#039;domain provision&#039; you did back when you first setup your Samba network, except this time the backup contains all the database objects you&#039;ve added since then. Similar to doing a provision, you need to specify a new DC when you run the restore command. This new DC &#039;&#039;&#039;&#039;&#039;must not&#039;&#039;&#039;&#039;&#039; have existed previously in the Samba network. The restore command will look something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup restore --backup-file=&amp;lt;tar-file&amp;gt; --newservername=&amp;lt;DC-name&amp;gt; --targetdir=&amp;lt;new-samba-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the target-directory specified must be empty (or non-existent). This means it&#039;s not practical to restore the domain database back into the default installation location (e.g. &amp;lt;tt&amp;gt;/usr/local/samba&amp;lt;/tt&amp;gt;). Instead, we recommend that you restore the domain database into a different targetdir, and then use the &#039;-s&#039; (or &#039;--configfile&#039;) option when running &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;samba -s &amp;lt;targetdir&amp;gt;/etc/smb.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying the restored smb.conf will mean that Samba will use the database files in the correct location. &lt;br /&gt;
&lt;br /&gt;
The restored DC will be added to the &#039;Default-First-Site-Name&#039; site. This site will be created in the restored DB if it does not already exist. You can specify an alternative site to add the restored DC to using the &amp;lt;tt&amp;gt;--site&amp;lt;/tt&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
Before starting &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored DC, you should double-check the restored smb.conf settings are correct. It may also be helpful to run &amp;lt;code&amp;gt;samba_dnsupdate&amp;lt;/code&amp;gt; (although this still gets run automatically when you start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Recommended strategy ==&lt;br /&gt;
&lt;br /&gt;
Restoring the backup-file has a couple of minor annoyances:&lt;br /&gt;
* Having to use a different directory to the default installation location.&lt;br /&gt;
* Having to specify a different DC server-name to what was previously in your network.&lt;br /&gt;
&lt;br /&gt;
The simple way to minimize these annoyances is to use a temporary server (or VM) for your restored DC. i.e.&lt;br /&gt;
* Restore the backup-file onto the temporary DC and start Samba.&lt;br /&gt;
* Rejoin the original DCs to the temporary DC one at a time. You can re-use the same server-name and default installation location during the join.&lt;br /&gt;
* Once all the original DCs have joined the restored domain, you can remove the temporary DC (i.e. using &#039;samba-tool domain demote&#039;). Your network of DCs should now be exactly the same as it was previously (except hopefully now in a valid working state!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
Note that if the backup or restore commands unexpectedly throw an error, they may leave behind a temporary directory in the &amp;lt;code&amp;gt;--targetdir&amp;lt;/code&amp;gt; you specified. These may help to provide clues as to why the failure occurred. If you&#039;re running the restore command, then you will need to clean these up manually before re-running the command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating Backups ==&lt;br /&gt;
&lt;br /&gt;
* Note that you should run the backup as root. Online backups can actually succeed as a non-root user, but it will cause you headaches later when you try to restore it.&lt;br /&gt;
&lt;br /&gt;
* For &#039;online&#039; or &#039;rename&#039; backups, sanity-check that the credentials and server details you&#039;re using are correct. E.g. try:&lt;br /&gt;
&amp;lt;pre&amp;gt;ldbsearch -H ldap://&amp;lt;server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Try increasing the debug-level to see if that tells you more about the failure. E.g. add the &amp;lt;code&amp;gt;--debug=3&amp;lt;/code&amp;gt; option to the command.&lt;br /&gt;
&lt;br /&gt;
* The &#039;online&#039; and &#039;rename&#039; commands work in a very similar way to a joining a DC. If joining a DC is known to fail on your network, then these commands are unlikely to work either. If you see the &#039;Committing SAM database&#039; and &#039;Cloned domain &amp;lt;domain&amp;gt;&#039; messages, then the join-like part of the backup has likely succeeded.&lt;br /&gt;
&lt;br /&gt;
* The backup tools do not work against a Windows DC (mostly just backing up the sysvol files fails). If you have a mixed DC domain, then backup a Samba DC rather than a Windows DC.&lt;br /&gt;
&lt;br /&gt;
* When doing an &#039;online&#039; or &#039;rename&#039; backup, samba-tool connects to DC over SMB to backup the sysvol share files (and their NTACLs). Depending on the &#039;min/max protocol&#039; smb.conf settings on your client/server, this SMB connection may fail, producing an error like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Cloned domain BACKUPDOMAIN (SID S-1-5-21-2948945078-3345239999-1381142759)&lt;br /&gt;
smbXcli_negprot: SMB signing is mandatory and the selected protocol level doesn&#039;t support it.&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225506, &#039;{Access Denied} A process has requested access to an object but has not been granted those access rights.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 183, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 248, in run&lt;br /&gt;
    smb_conn = smb.SMB(server, &amp;quot;sysvol&amp;quot;, lp=lp, creds=creds, sign=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This error message is a little misleading. The problem is the backup tool only works with SMBv1 protocols, and recent CVEs have recommended disabling SMBv1 on your DCs. Therefore the client and server cannot negotiate a compatible protocol, and the SMB connection can&#039;t be established. Bug #13621 is currently tracking this issue. The current workaround is to either do an &#039;offline&#039; backup locally on the DC (which doesn&#039;t require an SMB connection), or to temporarily re-enable SMBv1 while the backup is made.&lt;br /&gt;
&lt;br /&gt;
* An unusual corner-case is where you try to backup a brand new DC, before it&#039;s allocated a RID, which results in an error like below. Most users would be unlikely to ever see this, but if you do, the solution is to add a temporary user (i.e. &amp;lt;tt&amp;gt;samba-tool user create&amp;lt;/tt&amp;gt;), just to force a RID allocation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
samba-tool domain backup offline --targetdir=/home/ubuntu/backup&amp;lt;ldb result&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.IndexError&#039;&amp;gt;): uncaught exception - list index out of range&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 941, in run&lt;br /&gt;
    sid = get_sid_for_restore(samdb)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 80, in get_sid_for_restore&lt;br /&gt;
    rid = int(res[0].get(&#039;rIDNextRID&#039;)[0])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Note that offline backups require the lmdb-utils package installed, otherwise it throws an exception trying to run mdb_copy(). E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.OSError&#039;&amp;gt;): uncaught exception - [Errno 2] No such &lt;br /&gt;
file or directory                                                                              &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run                                                                                                           &lt;br /&gt;
    return self.run(*args, **kwargs)                                                                                                                                      &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 982, in run                                                                                                       &lt;br /&gt;
    self.backup_smb_dbs(paths.private_dir, samdb, lp, logger)                                                                                                             &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 907, in backup_smb_dbs&lt;br /&gt;
    copy_function(sam_file)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 866, in &lt;br /&gt;
offline_mdb_copy&lt;br /&gt;
    mdb_copy(path, path + self.backup_ext)&lt;br /&gt;
  File &amp;quot;bin/python/samba/mdb_util.py&amp;quot;, line 35, in mdb_copy&lt;br /&gt;
    status = subprocess.check_call(mdb_copy_cmd, close_fds=True, shell=False)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 185, in check_call&lt;br /&gt;
    retcode = call(*popenargs, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 172, in call&lt;br /&gt;
    return Popen(*popenargs, **kwargs).wait()&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 394, in __init__&lt;br /&gt;
    errread, errwrite)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 1047, in _execute_child&lt;br /&gt;
    raise child_exception&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Running the backup against a Windows DC generally fails during the backup of the sysvol share. You may see an error like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INFO 2019-01-15 15:29:11,850 pid:208088 bin/python/samba/join.py #1554: Cloned domain WINDOWS2012R2 (SID S-1-5-21-886655096-618523297-2770022155)&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225539, &#039;A file cannot be opened because the share access flags are incompatible.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 264, in run&lt;br /&gt;
    backup_online(smb_conn, sysvol_tar, remote_sam.get_domain_sid())&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 512, in backup_online&lt;br /&gt;
    ntacl_sddl_str = smb_helper.get_acl(r_name, as_sddl=True)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 334, in get_acl&lt;br /&gt;
    smb_path, SECURITY_SECINFO_FLAGS, SECURITY_SEC_FLAGS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem seems to be accessing the DfsrPrivate\Deleted and DfsrPrivate\Installing folders.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring backups ==&lt;br /&gt;
&lt;br /&gt;
* The restore command needs to be run as root. Part of the backup process involves preserving and restoring the NTACLs of the sysvol files, and some of the file operations involved require root permissions. If you&#039;re not root, then you&#039;ll probably see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;ERROR(&amp;lt;type &#039;exceptions.TypeError&#039;&amp;gt;): uncaught exception - (1, &#039;Operation not permitted&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 520, in run&lt;br /&gt;
    backup_restore(sysvol_tar, dest_sysvol_dir, samdb, smbconf)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 589, in backup_restore&lt;br /&gt;
    ntacls_helper.setntacl(dst, ntacl_sddl_str)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 445, in setntacl&lt;br /&gt;
    return setntacl(self.lp, path, ntacl_sd, self.dom_sid)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 214, in setntacl&lt;br /&gt;
    ndr_pack(ntacl))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;--newservername&amp;lt;/code&amp;gt; you specify for the restored DC must not already exist in the original domain. Otherwise you&#039;ll see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adding CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com&lt;br /&gt;
ERROR(ldb): uncaught exception - Entry CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com already exists&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 439, in run&lt;br /&gt;
    ctx.join_add_objects(specified_sid=dom_sid(sid))&lt;br /&gt;
  File &amp;quot;bin/python/samba/join.py&amp;quot;, line 625, in join_add_objects&lt;br /&gt;
    ctx.samdb.add(rec, controls=controls)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If the backup command was run locally on the DC, then the backup-file should contain the DC&#039;s smb.conf. However, the smb.conf in the backup-file may contain &#039;interfaces&#039; configuration that doesn&#039;t match the IP addresses on the DC you&#039;re restoring on. If this happens, you&#039;ll get an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Looking up IPv4 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv4 address will be assigned&lt;br /&gt;
Looking up IPv6 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv6 address will be assigned&lt;br /&gt;
ERROR: Please specify a host-ip for the new server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You can avoid this problem by specifying a &amp;lt;code&amp;gt;--host-ip&amp;lt;/code&amp;gt; argument during the restore. This should only affect rename backups.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Starting samba ==&lt;br /&gt;
&lt;br /&gt;
If you ran the backup as a non-root user, the restore will still succeed, but you&#039;ll hit errors when you try to start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;. E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo samba -s /tmp/online4/etc/smb.conf -i -d 3&lt;br /&gt;
samba version 4.10.0pre1-DEVELOPERBUILD started.&lt;br /&gt;
Copyright Andrew Tridgell and the Samba Team 1992-2018&lt;br /&gt;
...&lt;br /&gt;
directory_create_or_exist_strict: invalid ownership on directory /tmp/restore/private/msg.sock&lt;br /&gt;
exit_daemon: STATUS=daemon failed to start: Samba failed to setup parent messaging, error code -1073741801&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You could &amp;lt;tt&amp;gt;chown&amp;lt;/tt&amp;gt; your way out of this, but it&#039;s a lot simpler just to run the backup command as root.&lt;br /&gt;
&lt;br /&gt;
[[Category:Backup]] [[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10058</id>
		<title>Samba AD DCのバックアップとリストア</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10058"/>
		<updated>2019-03-12T15:28:25Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = This page describes creating a backup on Samba v4.9 onwards. For backups on Samba v4.0-v4.8, see [[Using_the_samba_backup_script|here]] for more details.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Samba backups provide a way to recover your Samba network, in the unlikely event that a catastrophic failure of the domain occurs.&lt;br /&gt;
&lt;br /&gt;
There are a few different flavours of backup, which work in different ways and achieve different things:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Online&#039;&#039;&#039;. This takes a clone of a running DC&#039;s database. It&#039;s similar in functionality to joining a new DC to the network.&lt;br /&gt;
* &#039;&#039;&#039;Offline&#039;&#039;&#039; (or &#039;local&#039;). This backs up the Samba files as they appear on disk. This includes replication meta-data that&#039;s local to this particular DC and which is not included in online backups. It can also create a backup file when the DC is offline (i.e. the &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; process is not actually running). &lt;br /&gt;
* &#039;&#039;&#039;Rename&#039;&#039;&#039;. This produces a backup file with the domain renamed, and is intended as only a temporary replacement. &lt;br /&gt;
&lt;br /&gt;
These different types of backup have several things in common. The backups are all produced using a variant of the &#039;samba-tool domain backup&#039; command. Each command creates a .tar.bz2 backup-file which contains an entire backup of the domain (based on a given DC). The backup-file can then be used to restore the domain using the &#039;samba-tool domain backup restore&#039; command.&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is a backup of your &#039;&#039;domain&#039;&#039;, not your &#039;&#039;DC&#039;&#039;. Restoring the backup-file will create a brand new DC with your domain&#039;s information. To restore subsequent DCs you must then [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|join]] fresh new DCs to the restored DC.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== So which backup should I use? ==&lt;br /&gt;
&lt;br /&gt;
This is a difficult question to answer, as it somewhat involves predicting how your Samba domain will fail. It also depends on how you plan to react to the failure. By creating a backup, you may be trying to achieve one of several different objectives:&lt;br /&gt;
&lt;br /&gt;
* Provide temporary replacment DC(s), which will buy you time while you troubleshoot and fix the problems on your original Samba network.&lt;br /&gt;
* Provide a long-term replacement for your domain, i.e. you plan to completely discard your failed domain and rollback to the last backup taken.&lt;br /&gt;
* Provide forensics on why the domain failure occurred in the first place, e.g. if a database corruption occurred, what factors may have led to the problem?&lt;br /&gt;
* Provide a &#039;good working state&#039; database that can be used as a guide for repairing and recovering deleted or corrupted objects in the production database.&lt;br /&gt;
&lt;br /&gt;
The rename backup works best for providing a temporary replacement domain, however, it is no good as a long-term replacement for the domain. Normally you can&#039;t run restored DCs and troubleshoot the failed domain DCs at the same time, because both will be using the same domain name (which will cause even more wild and weird problems to appear in your network). However, because the renamed backup is using a different domain name, it means you can safely run both the restored domain and the original domain in parallel.&lt;br /&gt;
&lt;br /&gt;
The online backup works best for providing a long-term replacement for your domain. It can be used as a temporary replacement, but you cannot easily troubleshoot the failed domain DCs at the same time. Investigating the reason behind the failure of a Samba domain could be time-consuming and technically complex work. If, in the event of a catastrophic domain failure, you don&#039;t intend to investigate the problem and just want to revert back to a older copy of a working domain, then this is the best option for you.&lt;br /&gt;
&lt;br /&gt;
The offline backup works best for forensics purposes, as it contains additional data that is not normally replicated. It can also be quicker to run an offline backup for a large domain, as you don&#039;t have the extra overhead of sending the database over the network and re-writing it to disk. However, note that the offline backup-file contains all the sensitive/secret information for your entire domain, so you still may not be able to share this backed-up information easily with Samba developers or mailing-lists. Also note that because the backup is copying the actual database on disk, there is potentially more chance that a corruption in the database is copied through to the backup.&lt;br /&gt;
&lt;br /&gt;
If you want to create multiple different types of backups, note that the details of the backup are saved in a &#039;backup.txt&#039; file within the backup-file itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing the backup restoration ==&lt;br /&gt;
&lt;br /&gt;
The often overlooked step in any disaster recovery plan is testing that your recovery system actually works before you need to put it into practice. Creating the backup-file is not much good if &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; fails to start up on your restored DC.&lt;br /&gt;
&lt;br /&gt;
Note that the backup/restore commands are new to Samba v4.9, and there may be something specific to your network which means they don&#039;t work as well as intended. It&#039;s better to find any problems now (and report them to the Samba mailing-list), rather than in an emergency.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, testing a Samba backup is hard to do. Because the online and offline backups use the exact same domain information as your production network, it is not safe to run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on a restored backup - the restored DC will interfere with your production network traffic.&lt;br /&gt;
&lt;br /&gt;
Here are a few options to help you gain confidence that your Samba backup will actually be useful.&lt;br /&gt;
* If you&#039;re generating a &#039;rename&#039; backup, then it&#039;s always safe to restore the backup-file onto a new DC and start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on it. So you can always sanity-check that your rename backup works successfully. A rename backup is quite similar to an online backup, so if your rename backup works, then you can have some confidence that your online backup would probably work too.&lt;br /&gt;
* It&#039;s always safe to restore the backup-file to disk, as long as you don&#039;t actually start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored database. You could then use tools like ldbsearch (by specifying the local filepath of the database on disk) to sanity-check database objects were backed up correctly.&lt;br /&gt;
* If you just want to get a better feel for what the various backup options do, one option is to [[create a samba lab-domain]], and then create and restore online/offline backups within the lab domain itself.&lt;br /&gt;
* Another option is configure your network switches to &#039;&#039;completely&#039;&#039; isolate the restored DC from the rest of your Samba network, although in practice this proves quite tricky to get right.&lt;br /&gt;
&lt;br /&gt;
Note that the backup tool creates a &#039;warts and all&#039; copy of the domain database. If you don&#039;t run &amp;lt;code&amp;gt;samba-tool dbcheck&amp;lt;/code&amp;gt; over your Samba database regularly, then it&#039;s worth getting into the habit, especially before you generate a new backup. Otherwise, any problems in your database will persist right through a backup and restore of your domain. Dbcheck will report any obvious problems that exist in your database, and provides a &#039;--fix&#039; option that will resolve the problems for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Online DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create an online backup, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup online --targetdir=&amp;lt;output-dir&amp;gt; --server=&amp;lt;DC-server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command can be run locally on the DC or remotely. If running the command remotely, you may want to specify a &amp;lt;code&amp;gt;--configfile&amp;lt;/code&amp;gt; option so that the correct smb.conf settings get included in the backup.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Offline/local DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create a offline backup, login on the DC you&#039;re backing up, and simply specify the target-directory location to write the backup-file to. E.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup offline --targetdir=&amp;lt;output-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that despite this option&#039;s name, the DC does not actually need to be offline when running this command. The tool is simply backing up the local files and it has sufficient locking in place to ensure the backup is generated safely.&lt;br /&gt;
&lt;br /&gt;
Note that while the other backup commands are available from Samba v4.9 onwards, the offline command is not included until the subsequent Samba release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Domain rename backup ==&lt;br /&gt;
&lt;br /&gt;
For more details on creating a rename backup, see [[Domain rename tool]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Untarring backups ==&lt;br /&gt;
&lt;br /&gt;
If you simply want to use the backup for forensic purposes (i.e. interrogating the details of specific database objects in a &#039;good&#039; state), then it&#039;s safe to just untar the backup-file and query the database directly on disk. Note that you cannot run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on an untarred backup - you &#039;&#039;must&#039;&#039; use the restore command to do this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the domain ==&lt;br /&gt;
&lt;br /&gt;
In the event of a catastrophic domain failure, to restore the domain from backup-file you would do the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stop &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on &#039;&#039;all&#039;&#039; the old DCs. (Unless you&#039;re using a renamed backup, in which case you can skip this step).&lt;br /&gt;
&amp;lt;li&amp;gt; Run the &#039;samba-tool domain backup restore&#039; command to restore the domain database on a single new DC. See below for more details.&lt;br /&gt;
&amp;lt;li&amp;gt; Start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the new DC.&lt;br /&gt;
&amp;lt;li&amp;gt; Re-add the old DCs back to the network by [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|joining]] them to the restored DC, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;samba-tool domain join &amp;lt;dns-realm&amp;gt; DC --server=&amp;lt;restored-dc&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; If you&#039;re using a renamed backup, you would then need to re-configure your network appliances so that traffic is redirected to the restored domain, instead of the failed/original domain.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is recovering the &#039;&#039;entire domain&#039;&#039;, not a specific DC. The &#039;samba-tool domain backup restore&#039; step is only done once, which re-creates the domain on a single DC. All old DCs must then be re-joined to the restored DC, in order to rejoin the domain.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the backup-file ==&lt;br /&gt;
&lt;br /&gt;
The step to restore a backup is similar to the &#039;domain provision&#039; you did back when you first setup your Samba network, except this time the backup contains all the database objects you&#039;ve added since then. Similar to doing a provision, you need to specify a new DC when you run the restore command. This new DC &#039;&#039;&#039;&#039;&#039;must not&#039;&#039;&#039;&#039;&#039; have existed previously in the Samba network. The restore command will look something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup restore --backup-file=&amp;lt;tar-file&amp;gt; --newservername=&amp;lt;DC-name&amp;gt; --targetdir=&amp;lt;new-samba-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the target-directory specified must be empty (or non-existent). This means it&#039;s not practical to restore the domain database back into the default installation location (e.g. &amp;lt;tt&amp;gt;/usr/local/samba&amp;lt;/tt&amp;gt;). Instead, we recommend that you restore the domain database into a different targetdir, and then use the &#039;-s&#039; (or &#039;--configfile&#039;) option when running &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;samba -s &amp;lt;targetdir&amp;gt;/etc/smb.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying the restored smb.conf will mean that Samba will use the database files in the correct location. &lt;br /&gt;
&lt;br /&gt;
The restored DC will be added to the &#039;Default-First-Site-Name&#039; site. This site will be created in the restored DB if it does not already exist. You can specify an alternative site to add the restored DC to using the &amp;lt;tt&amp;gt;--site&amp;lt;/tt&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
Before starting &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored DC, you should double-check the restored smb.conf settings are correct. It may also be helpful to run &amp;lt;code&amp;gt;samba_dnsupdate&amp;lt;/code&amp;gt; (although this still gets run automatically when you start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Recommended strategy ==&lt;br /&gt;
&lt;br /&gt;
Restoring the backup-file has a couple of minor annoyances:&lt;br /&gt;
* Having to use a different directory to the default installation location.&lt;br /&gt;
* Having to specify a different DC server-name to what was previously in your network.&lt;br /&gt;
&lt;br /&gt;
The simple way to minimize these annoyances is to use a temporary server (or VM) for your restored DC. i.e.&lt;br /&gt;
* Restore the backup-file onto the temporary DC and start Samba.&lt;br /&gt;
* Rejoin the original DCs to the temporary DC one at a time. You can re-use the same server-name and default installation location during the join.&lt;br /&gt;
* Once all the original DCs have joined the restored domain, you can remove the temporary DC (i.e. using &#039;samba-tool domain demote&#039;). Your network of DCs should now be exactly the same as it was previously (except hopefully now in a valid working state!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
Note that if the backup or restore commands unexpectedly throw an error, they may leave behind a temporary directory in the &amp;lt;code&amp;gt;--targetdir&amp;lt;/code&amp;gt; you specified. These may help to provide clues as to why the failure occurred. If you&#039;re running the restore command, then you will need to clean these up manually before re-running the command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating Backups ==&lt;br /&gt;
&lt;br /&gt;
* Note that you should run the backup as root. Online backups can actually succeed as a non-root user, but it will cause you headaches later when you try to restore it.&lt;br /&gt;
&lt;br /&gt;
* For &#039;online&#039; or &#039;rename&#039; backups, sanity-check that the credentials and server details you&#039;re using are correct. E.g. try:&lt;br /&gt;
&amp;lt;pre&amp;gt;ldbsearch -H ldap://&amp;lt;server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Try increasing the debug-level to see if that tells you more about the failure. E.g. add the &amp;lt;code&amp;gt;--debug=3&amp;lt;/code&amp;gt; option to the command.&lt;br /&gt;
&lt;br /&gt;
* The &#039;online&#039; and &#039;rename&#039; commands work in a very similar way to a joining a DC. If joining a DC is known to fail on your network, then these commands are unlikely to work either. If you see the &#039;Committing SAM database&#039; and &#039;Cloned domain &amp;lt;domain&amp;gt;&#039; messages, then the join-like part of the backup has likely succeeded.&lt;br /&gt;
&lt;br /&gt;
* The backup tools do not work against a Windows DC (mostly just backing up the sysvol files fails). If you have a mixed DC domain, then backup a Samba DC rather than a Windows DC.&lt;br /&gt;
&lt;br /&gt;
* When doing an &#039;online&#039; or &#039;rename&#039; backup, samba-tool connects to DC over SMB to backup the sysvol share files (and their NTACLs). Depending on the &#039;min/max protocol&#039; smb.conf settings on your client/server, this SMB connection may fail, producing an error like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Cloned domain BACKUPDOMAIN (SID S-1-5-21-2948945078-3345239999-1381142759)&lt;br /&gt;
smbXcli_negprot: SMB signing is mandatory and the selected protocol level doesn&#039;t support it.&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225506, &#039;{Access Denied} A process has requested access to an object but has not been granted those access rights.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 183, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 248, in run&lt;br /&gt;
    smb_conn = smb.SMB(server, &amp;quot;sysvol&amp;quot;, lp=lp, creds=creds, sign=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This error message is a little misleading. The problem is the backup tool only works with SMBv1 protocols, and recent CVEs have recommended disabling SMBv1 on your DCs. Therefore the client and server cannot negotiate a compatible protocol, and the SMB connection can&#039;t be established. Bug #13621 is currently tracking this issue. The current workaround is to either do an &#039;offline&#039; backup locally on the DC (which doesn&#039;t require an SMB connection), or to temporarily re-enable SMBv1 while the backup is made.&lt;br /&gt;
&lt;br /&gt;
* An unusual corner-case is where you try to backup a brand new DC, before it&#039;s allocated a RID, which results in an error like below. Most users would be unlikely to ever see this, but if you do, the solution is to add a temporary user (i.e. &amp;lt;tt&amp;gt;samba-tool user create&amp;lt;/tt&amp;gt;), just to force a RID allocation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
samba-tool domain backup offline --targetdir=/home/ubuntu/backup&amp;lt;ldb result&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.IndexError&#039;&amp;gt;): uncaught exception - list index out of range&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 941, in run&lt;br /&gt;
    sid = get_sid_for_restore(samdb)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 80, in get_sid_for_restore&lt;br /&gt;
    rid = int(res[0].get(&#039;rIDNextRID&#039;)[0])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Note that offline backups require the lmdb-utils package installed, otherwise it throws an exception trying to run mdb_copy(). E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.OSError&#039;&amp;gt;): uncaught exception - [Errno 2] No such &lt;br /&gt;
file or directory                                                                              &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run                                                                                                           &lt;br /&gt;
    return self.run(*args, **kwargs)                                                                                                                                      &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 982, in run                                                                                                       &lt;br /&gt;
    self.backup_smb_dbs(paths.private_dir, samdb, lp, logger)                                                                                                             &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 907, in backup_smb_dbs&lt;br /&gt;
    copy_function(sam_file)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 866, in &lt;br /&gt;
offline_mdb_copy&lt;br /&gt;
    mdb_copy(path, path + self.backup_ext)&lt;br /&gt;
  File &amp;quot;bin/python/samba/mdb_util.py&amp;quot;, line 35, in mdb_copy&lt;br /&gt;
    status = subprocess.check_call(mdb_copy_cmd, close_fds=True, shell=False)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 185, in check_call&lt;br /&gt;
    retcode = call(*popenargs, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 172, in call&lt;br /&gt;
    return Popen(*popenargs, **kwargs).wait()&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 394, in __init__&lt;br /&gt;
    errread, errwrite)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 1047, in _execute_child&lt;br /&gt;
    raise child_exception&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Running the backup against a Windows DC generally fails during the backup of the sysvol share. You may see an error like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INFO 2019-01-15 15:29:11,850 pid:208088 bin/python/samba/join.py #1554: Cloned domain WINDOWS2012R2 (SID S-1-5-21-886655096-618523297-2770022155)&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225539, &#039;A file cannot be opened because the share access flags are incompatible.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 264, in run&lt;br /&gt;
    backup_online(smb_conn, sysvol_tar, remote_sam.get_domain_sid())&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 512, in backup_online&lt;br /&gt;
    ntacl_sddl_str = smb_helper.get_acl(r_name, as_sddl=True)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 334, in get_acl&lt;br /&gt;
    smb_path, SECURITY_SECINFO_FLAGS, SECURITY_SEC_FLAGS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem seems to be accessing the DfsrPrivate\Deleted and DfsrPrivate\Installing folders.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring backups ==&lt;br /&gt;
&lt;br /&gt;
* The restore command needs to be run as root. Part of the backup process involves preserving and restoring the NTACLs of the sysvol files, and some of the file operations involved require root permissions. If you&#039;re not root, then you&#039;ll probably see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;ERROR(&amp;lt;type &#039;exceptions.TypeError&#039;&amp;gt;): uncaught exception - (1, &#039;Operation not permitted&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 520, in run&lt;br /&gt;
    backup_restore(sysvol_tar, dest_sysvol_dir, samdb, smbconf)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 589, in backup_restore&lt;br /&gt;
    ntacls_helper.setntacl(dst, ntacl_sddl_str)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 445, in setntacl&lt;br /&gt;
    return setntacl(self.lp, path, ntacl_sd, self.dom_sid)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 214, in setntacl&lt;br /&gt;
    ndr_pack(ntacl))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;--newservername&amp;lt;/code&amp;gt; you specify for the restored DC must not already exist in the original domain. Otherwise you&#039;ll see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adding CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com&lt;br /&gt;
ERROR(ldb): uncaught exception - Entry CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com already exists&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 439, in run&lt;br /&gt;
    ctx.join_add_objects(specified_sid=dom_sid(sid))&lt;br /&gt;
  File &amp;quot;bin/python/samba/join.py&amp;quot;, line 625, in join_add_objects&lt;br /&gt;
    ctx.samdb.add(rec, controls=controls)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If the backup command was run locally on the DC, then the backup-file should contain the DC&#039;s smb.conf. However, the smb.conf in the backup-file may contain &#039;interfaces&#039; configuration that doesn&#039;t match the IP addresses on the DC you&#039;re restoring on. If this happens, you&#039;ll get an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Looking up IPv4 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv4 address will be assigned&lt;br /&gt;
Looking up IPv6 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv6 address will be assigned&lt;br /&gt;
ERROR: Please specify a host-ip for the new server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You can avoid this problem by specifying a &amp;lt;code&amp;gt;--host-ip&amp;lt;/code&amp;gt; argument during the restore. This should only affect rename backups.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Starting samba ==&lt;br /&gt;
&lt;br /&gt;
If you ran the backup as a non-root user, the restore will still succeed, but you&#039;ll hit errors when you try to start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;. E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo samba -s /tmp/online4/etc/smb.conf -i -d 3&lt;br /&gt;
samba version 4.10.0pre1-DEVELOPERBUILD started.&lt;br /&gt;
Copyright Andrew Tridgell and the Samba Team 1992-2018&lt;br /&gt;
...&lt;br /&gt;
directory_create_or_exist_strict: invalid ownership on directory /tmp/restore/private/msg.sock&lt;br /&gt;
exit_daemon: STATUS=daemon failed to start: Samba failed to setup parent messaging, error code -1073741801&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You could &amp;lt;tt&amp;gt;chown&amp;lt;/tt&amp;gt; your way out of this, but it&#039;s a lot simpler just to run the backup command as root.&lt;br /&gt;
&lt;br /&gt;
[[Category:Backup]] [[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10057</id>
		<title>Samba AD DCのバックアップとリストア</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10057"/>
		<updated>2019-03-12T15:28:06Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = This page describes creating a backup on Samba v4.9 onwards. For backups on Samba v4.0-v4.8, see [[Using_the_samba_backup_script|here]] for more details.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Samba backups provide a way to recover your Samba network, in the unlikely event that a catastrophic failure of the domain occurs.&lt;br /&gt;
&lt;br /&gt;
There are a few different flavours of backup, which work in different ways and achieve different things:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Online&#039;&#039;&#039;. This takes a clone of a running DC&#039;s database. It&#039;s similar in functionality to joining a new DC to the network.&lt;br /&gt;
* &#039;&#039;&#039;Offline&#039;&#039;&#039; (or &#039;local&#039;). This backs up the Samba files as they appear on disk. This includes replication meta-data that&#039;s local to this particular DC and which is not included in online backups. It can also create a backup file when the DC is offline (i.e. the &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; process is not actually running). &lt;br /&gt;
* &#039;&#039;&#039;Rename&#039;&#039;&#039;. This produces a backup file with the domain renamed, and is intended as only a temporary replacement. &lt;br /&gt;
&lt;br /&gt;
These different types of backup have several things in common. The backups are all produced using a variant of the &#039;samba-tool domain backup&#039; command. Each command creates a .tar.bz2 backup-file which contains an entire backup of the domain (based on a given DC). The backup-file can then be used to restore the domain using the &#039;samba-tool domain backup restore&#039; command.&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is a backup of your &#039;&#039;domain&#039;&#039;, not your &#039;&#039;DC&#039;&#039;. Restoring the backup-file will create a brand new DC with your domain&#039;s information. To restore subsequent DCs you must then [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|join]] fresh new DCs to the restored DC.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== So which backup should I use? ==&lt;br /&gt;
&lt;br /&gt;
This is a difficult question to answer, as it somewhat involves predicting how your Samba domain will fail. It also depends on how you plan to react to the failure. By creating a backup, you may be trying to achieve one of several different objectives:&lt;br /&gt;
&lt;br /&gt;
* Provide temporary replacment DC(s), which will buy you time while you troubleshoot and fix the problems on your original Samba network.&lt;br /&gt;
* Provide a long-term replacement for your domain, i.e. you plan to completely discard your failed domain and rollback to the last backup taken.&lt;br /&gt;
* Provide forensics on why the domain failure occurred in the first place, e.g. if a database corruption occurred, what factors may have led to the problem?&lt;br /&gt;
* Provide a &#039;good working state&#039; database that can be used as a guide for repairing and recovering deleted or corrupted objects in the production database.&lt;br /&gt;
&lt;br /&gt;
The rename backup works best for providing a temporary replacement domain, however, it is no good as a long-term replacement for the domain. Normally you can&#039;t run restored DCs and troubleshoot the failed domain DCs at the same time, because both will be using the same domain name (which will cause even more wild and weird problems to appear in your network). However, because the renamed backup is using a different domain name, it means you can safely run both the restored domain and the original domain in parallel.&lt;br /&gt;
&lt;br /&gt;
The online backup works best for providing a long-term replacement for your domain. It can be used as a temporary replacement, but you cannot easily troubleshoot the failed domain DCs at the same time. Investigating the reason behind the failure of a Samba domain could be time-consuming and technically complex work. If, in the event of a catastrophic domain failure, you don&#039;t intend to investigate the problem and just want to revert back to a older copy of a working domain, then this is the best option for you.&lt;br /&gt;
&lt;br /&gt;
The offline backup works best for forensics purposes, as it contains additional data that is not normally replicated. It can also be quicker to run an offline backup for a large domain, as you don&#039;t have the extra overhead of sending the database over the network and re-writing it to disk. However, note that the offline backup-file contains all the sensitive/secret information for your entire domain, so you still may not be able to share this backed-up information easily with Samba developers or mailing-lists. Also note that because the backup is copying the actual database on disk, there is potentially more chance that a corruption in the database is copied through to the backup.&lt;br /&gt;
&lt;br /&gt;
If you want to create multiple different types of backups, note that the details of the backup are saved in a &#039;backup.txt&#039; file within the backup-file itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing the backup restoration ==&lt;br /&gt;
&lt;br /&gt;
The often overlooked step in any disaster recovery plan is testing that your recovery system actually works before you need to put it into practice. Creating the backup-file is not much good if &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; fails to start up on your restored DC.&lt;br /&gt;
&lt;br /&gt;
Note that the backup/restore commands are new to Samba v4.9, and there may be something specific to your network which means they don&#039;t work as well as intended. It&#039;s better to find any problems now (and report them to the Samba mailing-list), rather than in an emergency.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, testing a Samba backup is hard to do. Because the online and offline backups use the exact same domain information as your production network, it is not safe to run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on a restored backup - the restored DC will interfere with your production network traffic.&lt;br /&gt;
&lt;br /&gt;
Here are a few options to help you gain confidence that your Samba backup will actually be useful.&lt;br /&gt;
* If you&#039;re generating a &#039;rename&#039; backup, then it&#039;s always safe to restore the backup-file onto a new DC and start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on it. So you can always sanity-check that your rename backup works successfully. A rename backup is quite similar to an online backup, so if your rename backup works, then you can have some confidence that your online backup would probably work too.&lt;br /&gt;
* It&#039;s always safe to restore the backup-file to disk, as long as you don&#039;t actually start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored database. You could then use tools like ldbsearch (by specifying the local filepath of the database on disk) to sanity-check database objects were backed up correctly.&lt;br /&gt;
* If you just want to get a better feel for what the various backup options do, one option is to [[create a samba lab-domain]], and then create and restore online/offline backups within the lab domain itself.&lt;br /&gt;
* Another option is configure your network switches to &#039;&#039;completely&#039;&#039; isolate the restored DC from the rest of your Samba network, although in practice this proves quite tricky to get right.&lt;br /&gt;
&lt;br /&gt;
Note that the backup tool creates a &#039;warts and all&#039; copy of the domain database. If you don&#039;t run &amp;lt;code&amp;gt;samba-tool dbcheck&amp;lt;/code&amp;gt; over your Samba database regularly, then it&#039;s worth getting into the habit, especially before you generate a new backup. Otherwise, any problems in your database will persist right through a backup and restore of your domain. Dbcheck will report any obvious problems that exist in your database, and provides a &#039;--fix&#039; option that will resolve the problems for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Online DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create an online backup, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup online --targetdir=&amp;lt;output-dir&amp;gt; --server=&amp;lt;DC-server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command can be run locally on the DC or remotely. If running the command remotely, you may want to specify a &amp;lt;code&amp;gt;--configfile&amp;lt;/code&amp;gt; option so that the correct smb.conf settings get included in the backup.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Offline/local DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create a offline backup, login on the DC you&#039;re backing up, and simply specify the target-directory location to write the backup-file to. E.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup offline --targetdir=&amp;lt;output-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that despite this option&#039;s name, the DC does not actually need to be offline when running this command. The tool is simply backing up the local files and it has sufficient locking in place to ensure the backup is generated safely.&lt;br /&gt;
&lt;br /&gt;
Note that while the other backup commands are available from Samba v4.9 onwards, the offline command is not included until the subsequent Samba release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Domain rename backup ==&lt;br /&gt;
&lt;br /&gt;
For more details on creating a rename backup, see [[Domain rename tool]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Untarring backups ==&lt;br /&gt;
&lt;br /&gt;
If you simply want to use the backup for forensic purposes (i.e. interrogating the details of specific database objects in a &#039;good&#039; state), then it&#039;s safe to just untar the backup-file and query the database directly on disk. Note that you cannot run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on an untarred backup - you &#039;&#039;must&#039;&#039; use the restore command to do this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the domain ==&lt;br /&gt;
&lt;br /&gt;
In the event of a catastrophic domain failure, to restore the domain from backup-file you would do the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stop &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on &#039;&#039;all&#039;&#039; the old DCs. (Unless you&#039;re using a renamed backup, in which case you can skip this step).&lt;br /&gt;
&amp;lt;li&amp;gt; Run the &#039;samba-tool domain backup restore&#039; command to restore the domain database on a single new DC. See below for more details.&lt;br /&gt;
&amp;lt;li&amp;gt; Start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the new DC.&lt;br /&gt;
&amp;lt;li&amp;gt; Re-add the old DCs back to the network by [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|joining]] them to the restored DC, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;samba-tool domain join &amp;lt;dns-realm&amp;gt; DC --server=&amp;lt;restored-dc&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; If you&#039;re using a renamed backup, you would then need to re-configure your network appliances so that traffic is redirected to the restored domain, instead of the failed/original domain.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is recovering the &#039;&#039;entire domain&#039;&#039;, not a specific DC. The &#039;samba-tool domain backup restore&#039; step is only done once, which re-creates the domain on a single DC. All old DCs must then be re-joined to the restored DC, in order to rejoin the domain.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the backup-file ==&lt;br /&gt;
&lt;br /&gt;
The step to restore a backup is similar to the &#039;domain provision&#039; you did back when you first setup your Samba network, except this time the backup contains all the database objects you&#039;ve added since then. Similar to doing a provision, you need to specify a new DC when you run the restore command. This new DC &#039;&#039;&#039;&#039;&#039;must not&#039;&#039;&#039;&#039;&#039; have existed previously in the Samba network. The restore command will look something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup restore --backup-file=&amp;lt;tar-file&amp;gt; --newservername=&amp;lt;DC-name&amp;gt; --targetdir=&amp;lt;new-samba-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the target-directory specified must be empty (or non-existent). This means it&#039;s not practical to restore the domain database back into the default installation location (e.g. &amp;lt;tt&amp;gt;/usr/local/samba&amp;lt;/tt&amp;gt;). Instead, we recommend that you restore the domain database into a different targetdir, and then use the &#039;-s&#039; (or &#039;--configfile&#039;) option when running &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;samba -s &amp;lt;targetdir&amp;gt;/etc/smb.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying the restored smb.conf will mean that Samba will use the database files in the correct location. &lt;br /&gt;
&lt;br /&gt;
The restored DC will be added to the &#039;Default-First-Site-Name&#039; site. This site will be created in the restored DB if it does not already exist. You can specify an alternative site to add the restored DC to using the &amp;lt;tt&amp;gt;--site&amp;lt;/tt&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
Before starting &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored DC, you should double-check the restored smb.conf settings are correct. It may also be helpful to run &amp;lt;code&amp;gt;samba_dnsupdate&amp;lt;/code&amp;gt; (although this still gets run automatically when you start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Recommended strategy ==&lt;br /&gt;
&lt;br /&gt;
Restoring the backup-file has a couple of minor annoyances:&lt;br /&gt;
* Having to use a different directory to the default installation location.&lt;br /&gt;
* Having to specify a different DC server-name to what was previously in your network.&lt;br /&gt;
&lt;br /&gt;
The simple way to minimize these annoyances is to use a temporary server (or VM) for your restored DC. i.e.&lt;br /&gt;
* Restore the backup-file onto the temporary DC and start Samba.&lt;br /&gt;
* Rejoin the original DCs to the temporary DC one at a time. You can re-use the same server-name and default installation location during the join.&lt;br /&gt;
* Once all the original DCs have joined the restored domain, you can remove the temporary DC (i.e. using &#039;samba-tool domain demote&#039;). Your network of DCs should now be exactly the same as it was previously (except hopefully now in a valid working state!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
Note that if the backup or restore commands unexpectedly throw an error, they may leave behind a temporary directory in the &amp;lt;code&amp;gt;--targetdir&amp;lt;/code&amp;gt; you specified. These may help to provide clues as to why the failure occurred. If you&#039;re running the restore command, then you will need to clean these up manually before re-running the command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating Backups ==&lt;br /&gt;
&lt;br /&gt;
* Note that you should run the backup as root. Online backups can actually succeed as a non-root user, but it will cause you headaches later when you try to restore it.&lt;br /&gt;
&lt;br /&gt;
* For &#039;online&#039; or &#039;rename&#039; backups, sanity-check that the credentials and server details you&#039;re using are correct. E.g. try:&lt;br /&gt;
&amp;lt;pre&amp;gt;ldbsearch -H ldap://&amp;lt;server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Try increasing the debug-level to see if that tells you more about the failure. E.g. add the &amp;lt;code&amp;gt;--debug=3&amp;lt;/code&amp;gt; option to the command.&lt;br /&gt;
&lt;br /&gt;
* The &#039;online&#039; and &#039;rename&#039; commands work in a very similar way to a joining a DC. If joining a DC is known to fail on your network, then these commands are unlikely to work either. If you see the &#039;Committing SAM database&#039; and &#039;Cloned domain &amp;lt;domain&amp;gt;&#039; messages, then the join-like part of the backup has likely succeeded.&lt;br /&gt;
&lt;br /&gt;
* The backup tools do not work against a Windows DC (mostly just backing up the sysvol files fails). If you have a mixed DC domain, then backup a Samba DC rather than a Windows DC.&lt;br /&gt;
&lt;br /&gt;
* When doing an &#039;online&#039; or &#039;rename&#039; backup, samba-tool connects to DC over SMB to backup the sysvol share files (and their NTACLs). Depending on the &#039;min/max protocol&#039; smb.conf settings on your client/server, this SMB connection may fail, producing an error like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Cloned domain BACKUPDOMAIN (SID S-1-5-21-2948945078-3345239999-1381142759)&lt;br /&gt;
smbXcli_negprot: SMB signing is mandatory and the selected protocol level doesn&#039;t support it.&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225506, &#039;{Access Denied} A process has requested access to an object but has not been granted those access rights.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 183, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 248, in run&lt;br /&gt;
    smb_conn = smb.SMB(server, &amp;quot;sysvol&amp;quot;, lp=lp, creds=creds, sign=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This error message is a little misleading. The problem is the backup tool only works with SMBv1 protocols, and recent CVEs have recommended disabling SMBv1 on your DCs. Therefore the client and server cannot negotiate a compatible protocol, and the SMB connection can&#039;t be established. Bug #13621 is currently tracking this issue. The current workaround is to either do an &#039;offline&#039; backup locally on the DC (which doesn&#039;t require an SMB connection), or to temporarily re-enable SMBv1 while the backup is made.&lt;br /&gt;
&lt;br /&gt;
* An unusual corner-case is where you try to backup a brand new DC, before it&#039;s allocated a RID, which results in an error like below. Most users would be unlikely to ever see this, but if you do, the solution is to add a temporary user (i.e. &amp;lt;tt&amp;gt;samba-tool user create&amp;lt;/tt&amp;gt;), just to force a RID allocation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
samba-tool domain backup offline --targetdir=/home/ubuntu/backup&amp;lt;ldb result&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.IndexError&#039;&amp;gt;): uncaught exception - list index out of range&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 941, in run&lt;br /&gt;
    sid = get_sid_for_restore(samdb)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 80, in get_sid_for_restore&lt;br /&gt;
    rid = int(res[0].get(&#039;rIDNextRID&#039;)[0])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Note that offline backups require the lmdb-utils package installed, otherwise it throws an exception trying to run mdb_copy(). E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.OSError&#039;&amp;gt;): uncaught exception - [Errno 2] No such &lt;br /&gt;
file or directory                                                                              &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run                                                                                                           &lt;br /&gt;
    return self.run(*args, **kwargs)                                                                                                                                      &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 982, in run                                                                                                       &lt;br /&gt;
    self.backup_smb_dbs(paths.private_dir, samdb, lp, logger)                                                                                                             &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 907, in backup_smb_dbs&lt;br /&gt;
    copy_function(sam_file)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 866, in &lt;br /&gt;
offline_mdb_copy&lt;br /&gt;
    mdb_copy(path, path + self.backup_ext)&lt;br /&gt;
  File &amp;quot;bin/python/samba/mdb_util.py&amp;quot;, line 35, in mdb_copy&lt;br /&gt;
    status = subprocess.check_call(mdb_copy_cmd, close_fds=True, shell=False)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 185, in check_call&lt;br /&gt;
    retcode = call(*popenargs, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 172, in call&lt;br /&gt;
    return Popen(*popenargs, **kwargs).wait()&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 394, in __init__&lt;br /&gt;
    errread, errwrite)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 1047, in _execute_child&lt;br /&gt;
    raise child_exception&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Running the backup against a Windows DC generally fails during the backup of the sysvol share. You may see an error like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INFO 2019-01-15 15:29:11,850 pid:208088 bin/python/samba/join.py #1554: Cloned domain WINDOWS2012R2 (SID S-1-5-21-886655096-618523297-2770022155)&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225539, &#039;A file cannot be opened because the share access flags are incompatible.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 264, in run&lt;br /&gt;
    backup_online(smb_conn, sysvol_tar, remote_sam.get_domain_sid())&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 512, in backup_online&lt;br /&gt;
    ntacl_sddl_str = smb_helper.get_acl(r_name, as_sddl=True)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 334, in get_acl&lt;br /&gt;
    smb_path, SECURITY_SECINFO_FLAGS, SECURITY_SEC_FLAGS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem seems to be accessing the DfsrPrivate\Deleted and DfsrPrivate\Installing folders.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring backups ==&lt;br /&gt;
&lt;br /&gt;
* The restore command needs to be run as root. Part of the backup process involves preserving and restoring the NTACLs of the sysvol files, and some of the file operations involved require root permissions. If you&#039;re not root, then you&#039;ll probably see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;ERROR(&amp;lt;type &#039;exceptions.TypeError&#039;&amp;gt;): uncaught exception - (1, &#039;Operation not permitted&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 520, in run&lt;br /&gt;
    backup_restore(sysvol_tar, dest_sysvol_dir, samdb, smbconf)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 589, in backup_restore&lt;br /&gt;
    ntacls_helper.setntacl(dst, ntacl_sddl_str)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 445, in setntacl&lt;br /&gt;
    return setntacl(self.lp, path, ntacl_sd, self.dom_sid)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 214, in setntacl&lt;br /&gt;
    ndr_pack(ntacl))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;--newservername&amp;lt;/code&amp;gt; you specify for the restored DC must not already exist in the original domain. Otherwise you&#039;ll see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adding CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com&lt;br /&gt;
ERROR(ldb): uncaught exception - Entry CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com already exists&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 439, in run&lt;br /&gt;
    ctx.join_add_objects(specified_sid=dom_sid(sid))&lt;br /&gt;
  File &amp;quot;bin/python/samba/join.py&amp;quot;, line 625, in join_add_objects&lt;br /&gt;
    ctx.samdb.add(rec, controls=controls)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If the backup command was run locally on the DC, then the backup-file should contain the DC&#039;s smb.conf. However, the smb.conf in the backup-file may contain &#039;interfaces&#039; configuration that doesn&#039;t match the IP addresses on the DC you&#039;re restoring on. If this happens, you&#039;ll get an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Looking up IPv4 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv4 address will be assigned&lt;br /&gt;
Looking up IPv6 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv6 address will be assigned&lt;br /&gt;
ERROR: Please specify a host-ip for the new server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You can avoid this problem by specifying a &amp;lt;code&amp;gt;--host-ip&amp;lt;/code&amp;gt; argument during the restore. This should only affect rename backups.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Starting samba ==&lt;br /&gt;
&lt;br /&gt;
If you ran the backup as a non-root user, the restore will still succeed, but you&#039;ll hit errors when you try to start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;. E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo samba -s /tmp/online4/etc/smb.conf -i -d 3&lt;br /&gt;
samba version 4.10.0pre1-DEVELOPERBUILD started.&lt;br /&gt;
Copyright Andrew Tridgell and the Samba Team 1992-2018&lt;br /&gt;
...&lt;br /&gt;
directory_create_or_exist_strict: invalid ownership on directory /tmp/restore/private/msg.sock&lt;br /&gt;
exit_daemon: STATUS=daemon failed to start: Samba failed to setup parent messaging, error code -1073741801&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You could &amp;lt;tt&amp;gt;chown&amp;lt;/tt&amp;gt; your way out of this, but it&#039;s a lot simpler just to run the backup command as root.&lt;br /&gt;
&lt;br /&gt;
[[Category:Backup]] [[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=10056</id>
		<title>Sambaバックアップスクリプトを使用する</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=10056"/>
		<updated>2019-03-12T15:27:14Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* はじめに */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = このページはSamba v4.0-v4.8上でバックアップを作成することについて記載しています。Samba v4.9以降では、バックアップの作成が大幅に改善されました。詳細は[[Samba_AD_DCのバックアップとリストア | こちら]]を参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
このドキュメントの内容は、samba 4.xで使用するためのものです。&lt;br /&gt;
&lt;br /&gt;
これは、Samba AD DCのバックアップと復元に関するチュートリアルです。それは有用であることが期待されていますが、保証は一切ありません ！&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;この行が削除されるまで、このドキュメントはDRAFTとみなされます。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== 一般 ==&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = 警告：複数のDCを動作させている場合：バックアップからDCを復元しないでください。レプリケーションのメタデータが同期 しなくなると、ディレクトリが破損します。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
少なくとも1つの他のDCがまだ動作している場合は、[[Samba DCを既存のActive Directoryに参加させる|新しいマシンをDCとして再び接続]]します。他の実行中のDCからすべてが同期されます - まだ実装されていないSysVolレプリケーションを除きます。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = 元のDC上でのみバックアップを使用し、新しいDCに移動してDCをアップグレードすることは絶対にしないでください。この場合、代わりに新しいDCに参加してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
ドメイン内のすべてのDCが壊れている場合は、http://lists.samba.orgのsamba-technicalメーリングリストに投稿して、これを解決する最善の 方法について議論する必要があります。&lt;br /&gt;
&lt;br /&gt;
=== LDBおよびTDBファイルのバックアップ/リストア方法 ===&lt;br /&gt;
&lt;br /&gt;
&#039;samba_backup&#039;スクリプトを修正する予定がある場合や独自のソリューションを作成する場合は、ここでいくつかの有益な情報を見つけるでしょう：&lt;br /&gt;
&lt;br /&gt;
* 実行中のデータベースを決してコピーする必要はありませんが、&amp;lt;code&amp;gt;* .ldb&amp;lt;/code&amp;gt;＆&amp;lt;code&amp;gt;* .tdb&amp;lt;/code&amp;gt;ファイルを&#039;tdbbackup&#039;でオンラ インでバックアップできます。&lt;br /&gt;
* tdbbackupによって作成されたファイルは、完全なTDBファイルと通常のTDBファイルです。 tdbbackupは安全に抽出を行います。&lt;br /&gt;
* &amp;lt;code&amp;gt;* .ldb&amp;lt;/code&amp;gt;ファイルのバックアップは、単に &#039;.bak&#039;というサフィックスを削除するだけで元の名前に復元できます。&lt;br /&gt;
&lt;br /&gt;
=== samba_backupスクリプトについて ===&lt;br /&gt;
&lt;br /&gt;
Sambaはデータベースをバックアップする非常に基本的なシェルスクリプトを提供しています（ソースtarballの&amp;lt;code&amp;gt;source4/scripting/bin/samba_backup&amp;lt;/code&amp;gt;）。これには、Sambaインストール全体が1つの場所にあることが必要です（&amp;lt;code&amp;gt;/usr /local/samba/&amp;lt;/code&amp;gt;など）。 configureオプションを使用して異なる場所にsambaを格納している場合は、スクリプトを調整するか、ベースとして使用して独自のスクリプトを作成 できます。&lt;br /&gt;
&lt;br /&gt;
スクリプトは非常に基本的なものであり、それをそのまま使用する予定がある場合、注意すべき点が1つあります。&lt;br /&gt;
&lt;br /&gt;
* スクリプトは拡張ACLをバックアップしません。したがって、あなたはパーミッションを失います（例：SysVol共有）。--xattrsオプションを サポートするtarバージョン（tarのマンページを参照）がある場合は、このオプションをスクリプト内のすべての &#039;tar&#039;コマンドに追加する必要があります。これにより、tarはアーカイブ内の拡張ACLを保持できます。&lt;br /&gt;
&lt;br /&gt;
== バックアップ ==&lt;br /&gt;
&lt;br /&gt;
Sambaのバックアップスクリプトは、 &#039;make install&#039;によってインストールされません。ソースディレクトリ（&amp;lt;code&amp;gt;source4/scripting/bin/samba_backup&amp;lt;/code&amp;gt;）から&amp;lt;code&amp;gt;/usr/sbin&amp;lt;/code&amp;gt;のような場所にコピーし、安全な権限を設定する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# cp .../source4/scripting/bin/samba_backup /usr/sbin&lt;br /&gt;
# chown root:root /usr/sbin/samba_backup&lt;br /&gt;
# chmod 750 /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
スクリプト内の以下の変数を必要に応じて調整します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;FROMWHERE=/usr/local/samba&lt;br /&gt;
WHERE=/usr/local/backups&lt;br /&gt;
DAYS=90&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$WHERE&amp;lt;/code&amp;gt;変数に設定してアクセス権を設定した宛先フォルダを作成します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# mkdir /usr/local/backups&lt;br /&gt;
# chmod 750 /usr/local/backups&amp;lt;/pre&amp;gt;&lt;br /&gt;
最初のテストのバックアップスクリプトを開始します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
スクリプトがエラーなしで終了する場合は、出力先フォルダに3つのファイルがあります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;etc.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;samba4_private.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sysvol.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
テストバックアップが成功した場合は、毎日のバックアップ用にcronジョブを追加する必要があります。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# crontab -e&amp;lt;/pre&amp;gt;&lt;br /&gt;
毎日2:00AMにバックアップするために、次の行を追加します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;0 2 * * *       /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
注意：cronを使用してスクリプトを実行するときは、すべての必要なバイナリが&amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;変数の一部であるディレクトリにあることを確認してください。正しいパスがシステム全体で定義されていない場合は、変数をcrontabに設定するか、またはスクリプトの先頭でshebang(#!)行の後に設定します。&lt;br /&gt;
&lt;br /&gt;
== リストア ==&lt;br /&gt;
&lt;br /&gt;
以下のリストアガイドでは、 &#039;samba_backup&#039;スクリプトを使用してデータベースをバックアップしたことを前提としています。独自のスクリプ トをお持ちの場合は、手順を調整してください。&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;非常に重要なメモ：&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;同時に、復元とバージョンの変更を行わないでください！バックアップを作成したものと同じSambaバージョンを使用しているシステムでは、常に復元してください！&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;同じIPとホスト名を持つシステムでは、常にリストアしてください。そうしないと、KerberosとDNSの問題が発生します。&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;推奨：バックアップを作成したのと同じOSで復元してください。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;復元状況で最も重要なことは、システムを実行状態に戻すことです。すべてアップしてテストされたら、必要な変更を行うことができます。 復元と一緒に変更しようとしないでください！&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
システム全体が壊れている場合は、まずHowTo（[[SambaをActive Directoryドメインコントローラとして設定する]]）の説明に従ってマシン全体をセットアップする必要があります。&lt;br /&gt;
&lt;br /&gt;
復元するフォルダを削除します（sambaは停止している状態で）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rm -rf /usr/local/samba/etc&lt;br /&gt;
# rm -rf /usr/local/samba/private&lt;br /&gt;
# rm -rf /usr/local/samba/var/locks/sysvol&amp;lt;/pre&amp;gt;&lt;br /&gt;
最新の作業用バックアップファイルを元の場所に展開します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# cd /usr/local/backups&lt;br /&gt;
# tar -jxf etc.{Timestamp}.tar.bz2 -C /usr/local/samba/&lt;br /&gt;
# tar -jxf samba4_private.{Timestamp}.tar.bz2 -C /usr/local/samba/&lt;br /&gt;
# tar -jxf sysvol.{Timestamp}.tar.bz2 -C /usr/local/samba/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt;ディレクトリの&amp;lt;code&amp;gt;*.ldb.bak&amp;lt;/code&amp;gt;ファイルの名前を&amp;lt;code&amp;gt;*.ldb&amp;lt;/code&amp;gt;に戻します。これはGNU &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; と&amp;lt;code&amp;gt;Bash&amp;lt;/code&amp;gt;で行うことができます：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# find /usr/local/samba/private/ -type f -name &#039;*.ldb.bak&#039; -print0 | while read -d $&#039;\0&#039; f ; do mv &amp;amp;quot;$f&amp;amp;quot; &amp;amp;quot;${f%.bak}&amp;amp;quot; ; done&amp;lt;/pre&amp;gt;&lt;br /&gt;
バックアップに拡張ACLが含まれていない場合（[[#samba_backupスクリプトについて|samba_backupスクリプトについて]]を参照）、以下を実行する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# samba-tool ntacl sysvolreset&amp;lt;/pre&amp;gt;&lt;br /&gt;
Bind as DNSバックエンドを使用する場合は、DNSデータベースのハードリンクを修正する必要があります。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# samba_upgradedns --dns-backend=BIND9_DLZ&amp;lt;/pre&amp;gt;&lt;br /&gt;
「[[BIND9 DLZ DNSバックエンド#新しいDNSエントリが解決できない|DNSバックエンド BIND - 新しいDNSバックエンドエントリが解決できない]]」 を参照してください。&lt;br /&gt;
&lt;br /&gt;
これで、sambaを起動し、復元が成功したかどうかをテストできます。&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ヒント&#039;&#039;&#039;：バックアップから単一のデータベースを復元することは可能ですが、一部のデータベースは他のデータベースにリンクされている可能性があるため、矛盾するシステムがないように注意してください。壊れたデータベースが他のデータベースに依存しているかどうか不明な場合は、http://lists.samba.orgの[mailto:samba-technical@lists.samba.org samba技術的]メーリングリストに問い合わせるか、すべてを復元する必要があります。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10055</id>
		<title>Samba AD DCのバックアップとリストア</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%81%A8%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2&amp;diff=10055"/>
		<updated>2019-03-12T15:06:30Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: ページの作成:「 : {{Imbox | type = important | text = This page describes creating a backup on Samba v4.9 onwards. For backups on Samba v4.0-v4.8, see Using_the_samba_backup_script|he…」&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = This page describes creating a backup on Samba v4.9 onwards. For backups on Samba v4.0-v4.8, see [[Using_the_samba_backup_script|here]] for more details.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Samba backups provide a way to recover your Samba network, in the unlikely event that a catastrophic failure of the domain occurs.&lt;br /&gt;
&lt;br /&gt;
There are a few different flavours of backup, which work in different ways and achieve different things:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Online&#039;&#039;&#039;. This takes a clone of a running DC&#039;s database. It&#039;s similar in functionality to joining a new DC to the network.&lt;br /&gt;
* &#039;&#039;&#039;Offline&#039;&#039;&#039; (or &#039;local&#039;). This backs up the Samba files as they appear on disk. This includes replication meta-data that&#039;s local to this particular DC and which is not included in online backups. It can also create a backup file when the DC is offline (i.e. the &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; process is not actually running). &lt;br /&gt;
* &#039;&#039;&#039;Rename&#039;&#039;&#039;. This produces a backup file with the domain renamed, and is intended as only a temporary replacement. &lt;br /&gt;
&lt;br /&gt;
These different types of backup have several things in common. The backups are all produced using a variant of the &#039;samba-tool domain backup&#039; command. Each command creates a .tar.bz2 backup-file which contains an entire backup of the domain (based on a given DC). The backup-file can then be used to restore the domain using the &#039;samba-tool domain backup restore&#039; command.&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is a backup of your &#039;&#039;domain&#039;&#039;, not your &#039;&#039;DC&#039;&#039;. Restoring the backup-file will create a brand new DC with your domain&#039;s information. To restore subsequent DCs you must then [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|join]] fresh new DCs to the restored DC.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== So which backup should I use? ==&lt;br /&gt;
&lt;br /&gt;
This is a difficult question to answer, as it somewhat involves predicting how your Samba domain will fail. It also depends on how you plan to react to the failure. By creating a backup, you may be trying to achieve one of several different objectives:&lt;br /&gt;
&lt;br /&gt;
* Provide temporary replacment DC(s), which will buy you time while you troubleshoot and fix the problems on your original Samba network.&lt;br /&gt;
* Provide a long-term replacement for your domain, i.e. you plan to completely discard your failed domain and rollback to the last backup taken.&lt;br /&gt;
* Provide forensics on why the domain failure occurred in the first place, e.g. if a database corruption occurred, what factors may have led to the problem?&lt;br /&gt;
* Provide a &#039;good working state&#039; database that can be used as a guide for repairing and recovering deleted or corrupted objects in the production database.&lt;br /&gt;
&lt;br /&gt;
The rename backup works best for providing a temporary replacement domain, however, it is no good as a long-term replacement for the domain. Normally you can&#039;t run restored DCs and troubleshoot the failed domain DCs at the same time, because both will be using the same domain name (which will cause even more wild and weird problems to appear in your network). However, because the renamed backup is using a different domain name, it means you can safely run both the restored domain and the original domain in parallel.&lt;br /&gt;
&lt;br /&gt;
The online backup works best for providing a long-term replacement for your domain. It can be used as a temporary replacement, but you cannot easily troubleshoot the failed domain DCs at the same time. Investigating the reason behind the failure of a Samba domain could be time-consuming and technically complex work. If, in the event of a catastrophic domain failure, you don&#039;t intend to investigate the problem and just want to revert back to a older copy of a working domain, then this is the best option for you.&lt;br /&gt;
&lt;br /&gt;
The offline backup works best for forensics purposes, as it contains additional data that is not normally replicated. It can also be quicker to run an offline backup for a large domain, as you don&#039;t have the extra overhead of sending the database over the network and re-writing it to disk. However, note that the offline backup-file contains all the sensitive/secret information for your entire domain, so you still may not be able to share this backed-up information easily with Samba developers or mailing-lists. Also note that because the backup is copying the actual database on disk, there is potentially more chance that a corruption in the database is copied through to the backup.&lt;br /&gt;
&lt;br /&gt;
If you want to create multiple different types of backups, note that the details of the backup are saved in a &#039;backup.txt&#039; file within the backup-file itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing the backup restoration ==&lt;br /&gt;
&lt;br /&gt;
The often overlooked step in any disaster recovery plan is testing that your recovery system actually works before you need to put it into practice. Creating the backup-file is not much good if &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; fails to start up on your restored DC.&lt;br /&gt;
&lt;br /&gt;
Note that the backup/restore commands are new to Samba v4.9, and there may be something specific to your network which means they don&#039;t work as well as intended. It&#039;s better to find any problems now (and report them to the Samba mailing-list), rather than in an emergency.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, testing a Samba backup is hard to do. Because the online and offline backups use the exact same domain information as your production network, it is not safe to run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on a restored backup - the restored DC will interfere with your production network traffic.&lt;br /&gt;
&lt;br /&gt;
Here are a few options to help you gain confidence that your Samba backup will actually be useful.&lt;br /&gt;
* If you&#039;re generating a &#039;rename&#039; backup, then it&#039;s always safe to restore the backup-file onto a new DC and start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on it. So you can always sanity-check that your rename backup works successfully. A rename backup is quite similar to an online backup, so if your rename backup works, then you can have some confidence that your online backup would probably work too.&lt;br /&gt;
* It&#039;s always safe to restore the backup-file to disk, as long as you don&#039;t actually start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored database. You could then use tools like ldbsearch (by specifying the local filepath of the database on disk) to sanity-check database objects were backed up correctly.&lt;br /&gt;
* If you just want to get a better feel for what the various backup options do, one option is to [[create a samba lab-domain]], and then create and restore online/offline backups within the lab domain itself.&lt;br /&gt;
* Another option is configure your network switches to &#039;&#039;completely&#039;&#039; isolate the restored DC from the rest of your Samba network, although in practice this proves quite tricky to get right.&lt;br /&gt;
&lt;br /&gt;
Note that the backup tool creates a &#039;warts and all&#039; copy of the domain database. If you don&#039;t run &amp;lt;code&amp;gt;samba-tool dbcheck&amp;lt;/code&amp;gt; over your Samba database regularly, then it&#039;s worth getting into the habit, especially before you generate a new backup. Otherwise, any problems in your database will persist right through a backup and restore of your domain. Dbcheck will report any obvious problems that exist in your database, and provides a &#039;--fix&#039; option that will resolve the problems for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Online DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create an online backup, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup online --targetdir=&amp;lt;output-dir&amp;gt; --server=&amp;lt;DC-server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command can be run locally on the DC or remotely. If running the command remotely, you may want to specify a &amp;lt;code&amp;gt;--configfile&amp;lt;/code&amp;gt; option so that the correct smb.conf settings get included in the backup.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Offline/local DC backup ==&lt;br /&gt;
&lt;br /&gt;
To create a offline backup, login on the DC you&#039;re backing up, and simply specify the target-directory location to write the backup-file to. E.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup offline --targetdir=&amp;lt;output-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that despite this option&#039;s name, the DC does not actually need to be offline when running this command. The tool is simply backing up the local files and it has sufficient locking in place to ensure the backup is generated safely.&lt;br /&gt;
&lt;br /&gt;
Note that while the other backup commands are available from Samba v4.9 onwards, the offline command is not included until the subsequent Samba release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Domain rename backup ==&lt;br /&gt;
&lt;br /&gt;
For more details on creating a rename backup, see [[Domain rename tool]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Untarring backups ==&lt;br /&gt;
&lt;br /&gt;
If you simply want to use the backup for forensic purposes (i.e. interrogating the details of specific database objects in a &#039;good&#039; state), then it&#039;s safe to just untar the backup-file and query the database directly on disk. Note that you cannot run &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on an untarred backup - you &#039;&#039;must&#039;&#039; use the restore command to do this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the domain ==&lt;br /&gt;
&lt;br /&gt;
In the event of a catastrophic domain failure, to restore the domain from backup-file you would do the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stop &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on &#039;&#039;all&#039;&#039; the old DCs. (Unless you&#039;re using a renamed backup, in which case you can skip this step).&lt;br /&gt;
&amp;lt;li&amp;gt; Run the &#039;samba-tool domain backup restore&#039; command to restore the domain database on a single new DC. See below for more details.&lt;br /&gt;
&amp;lt;li&amp;gt; Start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the new DC.&lt;br /&gt;
&amp;lt;li&amp;gt; Re-add the old DCs back to the network by [[Joining_a_Samba_DC_to_an_Existing_Active_Directory|joining]] them to the restored DC, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;samba-tool domain join &amp;lt;dns-realm&amp;gt; DC --server=&amp;lt;restored-dc&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; If you&#039;re using a renamed backup, you would then need to re-configure your network appliances so that traffic is redirected to the restored domain, instead of the failed/original domain.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = important&lt;br /&gt;
| text = Note that the backup-file is recovering the &#039;&#039;entire domain&#039;&#039;, not a specific DC. The &#039;samba-tool domain backup restore&#039; step is only done once, which re-creates the domain on a single DC. All old DCs must then be re-joined to the restored DC, in order to rejoin the domain.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring the backup-file ==&lt;br /&gt;
&lt;br /&gt;
The step to restore a backup is similar to the &#039;domain provision&#039; you did back when you first setup your Samba network, except this time the backup contains all the database objects you&#039;ve added since then. Similar to doing a provision, you need to specify a new DC when you run the restore command. This new DC &#039;&#039;&#039;&#039;&#039;must not&#039;&#039;&#039;&#039;&#039; have existed previously in the Samba network. The restore command will look something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo samba-tool domain backup restore --backup-file=&amp;lt;tar-file&amp;gt; --newservername=&amp;lt;DC-name&amp;gt; --targetdir=&amp;lt;new-samba-dir&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the target-directory specified must be empty (or non-existent). This means it&#039;s not practical to restore the domain database back into the default installation location (e.g. &amp;lt;tt&amp;gt;/usr/local/samba&amp;lt;/tt&amp;gt;). Instead, we recommend that you restore the domain database into a different targetdir, and then use the &#039;-s&#039; (or &#039;--configfile&#039;) option when running &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;samba -s &amp;lt;targetdir&amp;gt;/etc/smb.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specifying the restored smb.conf will mean that Samba will use the database files in the correct location. &lt;br /&gt;
&lt;br /&gt;
The restored DC will be added to the &#039;Default-First-Site-Name&#039; site. This site will be created in the restored DB if it does not already exist. You can specify an alternative site to add the restored DC to using the &amp;lt;tt&amp;gt;--site&amp;lt;/tt&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
Before starting &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt; on the restored DC, you should double-check the restored smb.conf settings are correct. It may also be helpful to run &amp;lt;code&amp;gt;samba_dnsupdate&amp;lt;/code&amp;gt; (although this still gets run automatically when you start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Recommended strategy ==&lt;br /&gt;
&lt;br /&gt;
Restoring the backup-file has a couple of minor annoyances:&lt;br /&gt;
* Having to use a different directory to the default installation location.&lt;br /&gt;
* Having to specify a different DC server-name to what was previously in your network.&lt;br /&gt;
&lt;br /&gt;
The simple way to minimize these annoyances is to use a temporary server (or VM) for your restored DC. i.e.&lt;br /&gt;
* Restore the backup-file onto the temporary DC and start Samba.&lt;br /&gt;
* Rejoin the original DCs to the temporary DC one at a time. You can re-use the same server-name and default installation location during the join.&lt;br /&gt;
* Once all the original DCs have joined the restored domain, you can remove the temporary DC (i.e. using &#039;samba-tool domain demote&#039;). Your network of DCs should now be exactly the same as it was previously (except hopefully now in a valid working state!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
Note that if the backup or restore commands unexpectedly throw an error, they may leave behind a temporary directory in the &amp;lt;code&amp;gt;--targetdir&amp;lt;/code&amp;gt; you specified. These may help to provide clues as to why the failure occurred. If you&#039;re running the restore command, then you will need to clean these up manually before re-running the command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating Backups ==&lt;br /&gt;
&lt;br /&gt;
* Note that you should run the backup as root. Online backups can actually succeed as a non-root user, but it will cause you headaches later when you try to restore it.&lt;br /&gt;
&lt;br /&gt;
* For &#039;online&#039; or &#039;rename&#039; backups, sanity-check that the credentials and server details you&#039;re using are correct. E.g. try:&lt;br /&gt;
&amp;lt;pre&amp;gt;ldbsearch -H ldap://&amp;lt;server&amp;gt; -UAdministrator&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Try increasing the debug-level to see if that tells you more about the failure. E.g. add the &amp;lt;code&amp;gt;--debug=3&amp;lt;/code&amp;gt; option to the command.&lt;br /&gt;
&lt;br /&gt;
* The &#039;online&#039; and &#039;rename&#039; commands work in a very similar way to a joining a DC. If joining a DC is known to fail on your network, then these commands are unlikely to work either. If you see the &#039;Committing SAM database&#039; and &#039;Cloned domain &amp;lt;domain&amp;gt;&#039; messages, then the join-like part of the backup has likely succeeded.&lt;br /&gt;
&lt;br /&gt;
* The backup tools do not work against a Windows DC (mostly just backing up the sysvol files fails). If you have a mixed DC domain, then backup a Samba DC rather than a Windows DC.&lt;br /&gt;
&lt;br /&gt;
* When doing an &#039;online&#039; or &#039;rename&#039; backup, samba-tool connects to DC over SMB to backup the sysvol share files (and their NTACLs). Depending on the &#039;min/max protocol&#039; smb.conf settings on your client/server, this SMB connection may fail, producing an error like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Cloned domain BACKUPDOMAIN (SID S-1-5-21-2948945078-3345239999-1381142759)&lt;br /&gt;
smbXcli_negprot: SMB signing is mandatory and the selected protocol level doesn&#039;t support it.&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225506, &#039;{Access Denied} A process has requested access to an object but has not been granted those access rights.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 183, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 248, in run&lt;br /&gt;
    smb_conn = smb.SMB(server, &amp;quot;sysvol&amp;quot;, lp=lp, creds=creds, sign=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:This error message is a little misleading. The problem is the backup tool only works with SMBv1 protocols, and recent CVEs have recommended disabling SMBv1 on your DCs. Therefore the client and server cannot negotiate a compatible protocol, and the SMB connection can&#039;t be established. Bug #13621 is currently tracking this issue. The current workaround is to either do an &#039;offline&#039; backup locally on the DC (which doesn&#039;t require an SMB connection), or to temporarily re-enable SMBv1 while the backup is made.&lt;br /&gt;
&lt;br /&gt;
* An unusual corner-case is where you try to backup a brand new DC, before it&#039;s allocated a RID, which results in an error like below. Most users would be unlikely to ever see this, but if you do, the solution is to add a temporary user (i.e. &amp;lt;tt&amp;gt;samba-tool user create&amp;lt;/tt&amp;gt;), just to force a RID allocation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
samba-tool domain backup offline --targetdir=/home/ubuntu/backup&amp;lt;ldb result&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.IndexError&#039;&amp;gt;): uncaught exception - list index out of range&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 941, in run&lt;br /&gt;
    sid = get_sid_for_restore(samdb)&lt;br /&gt;
  File &amp;quot;/usr/local/samba/lib/python2.7/site-packages/samba/netcmd/domain_backup.py&amp;quot;, line 80, in get_sid_for_restore&lt;br /&gt;
    rid = int(res[0].get(&#039;rIDNextRID&#039;)[0])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Note that offline backups require the lmdb-utils package installed, otherwise it throws an exception trying to run mdb_copy(). E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ERROR(&amp;lt;type &#039;exceptions.OSError&#039;&amp;gt;): uncaught exception - [Errno 2] No such &lt;br /&gt;
file or directory                                                                              &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run                                                                                                           &lt;br /&gt;
    return self.run(*args, **kwargs)                                                                                                                                      &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 982, in run                                                                                                       &lt;br /&gt;
    self.backup_smb_dbs(paths.private_dir, samdb, lp, logger)                                                                                                             &lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 907, in backup_smb_dbs&lt;br /&gt;
    copy_function(sam_file)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 866, in &lt;br /&gt;
offline_mdb_copy&lt;br /&gt;
    mdb_copy(path, path + self.backup_ext)&lt;br /&gt;
  File &amp;quot;bin/python/samba/mdb_util.py&amp;quot;, line 35, in mdb_copy&lt;br /&gt;
    status = subprocess.check_call(mdb_copy_cmd, close_fds=True, shell=False)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 185, in check_call&lt;br /&gt;
    retcode = call(*popenargs, **kwargs)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 172, in call&lt;br /&gt;
    return Popen(*popenargs, **kwargs).wait()&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 394, in __init__&lt;br /&gt;
    errread, errwrite)&lt;br /&gt;
  File &amp;quot;/usr/lib64/python2.7/subprocess.py&amp;quot;, line 1047, in _execute_child&lt;br /&gt;
    raise child_exception&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Running the backup against a Windows DC generally fails during the backup of the sysvol share. You may see an error like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INFO 2019-01-15 15:29:11,850 pid:208088 bin/python/samba/join.py #1554: Cloned domain WINDOWS2012R2 (SID S-1-5-21-886655096-618523297-2770022155)&lt;br /&gt;
ERROR(runtime): uncaught exception - (3221225539, &#039;A file cannot be opened because the share access flags are incompatible.&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 184, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 264, in run&lt;br /&gt;
    backup_online(smb_conn, sysvol_tar, remote_sam.get_domain_sid())&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 512, in backup_online&lt;br /&gt;
    ntacl_sddl_str = smb_helper.get_acl(r_name, as_sddl=True)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 334, in get_acl&lt;br /&gt;
    smb_path, SECURITY_SECINFO_FLAGS, SECURITY_SEC_FLAGS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem seems to be accessing the DfsrPrivate\Deleted and DfsrPrivate\Installing folders.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restoring backups ==&lt;br /&gt;
&lt;br /&gt;
* The restore command needs to be run as root. Part of the backup process involves preserving and restoring the NTACLs of the sysvol files, and some of the file operations involved require root permissions. If you&#039;re not root, then you&#039;ll probably see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;ERROR(&amp;lt;type &#039;exceptions.TypeError&#039;&amp;gt;): uncaught exception - (1, &#039;Operation not permitted&#039;)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 520, in run&lt;br /&gt;
    backup_restore(sysvol_tar, dest_sysvol_dir, samdb, smbconf)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 589, in backup_restore&lt;br /&gt;
    ntacls_helper.setntacl(dst, ntacl_sddl_str)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 445, in setntacl&lt;br /&gt;
    return setntacl(self.lp, path, ntacl_sd, self.dom_sid)&lt;br /&gt;
  File &amp;quot;bin/python/samba/ntacls.py&amp;quot;, line 214, in setntacl&lt;br /&gt;
    ndr_pack(ntacl))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;--newservername&amp;lt;/code&amp;gt; you specify for the restored DC must not already exist in the original domain. Otherwise you&#039;ll see an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adding CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com&lt;br /&gt;
ERROR(ldb): uncaught exception - Entry CN=PROD-DC,OU=Domain Controllers,DC=lab,DC=example,DC=com already exists&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/__init__.py&amp;quot;, line 177, in _run&lt;br /&gt;
    return self.run(*args, **kwargs)&lt;br /&gt;
  File &amp;quot;bin/python/samba/netcmd/domain_backup.py&amp;quot;, line 439, in run&lt;br /&gt;
    ctx.join_add_objects(specified_sid=dom_sid(sid))&lt;br /&gt;
  File &amp;quot;bin/python/samba/join.py&amp;quot;, line 625, in join_add_objects&lt;br /&gt;
    ctx.samdb.add(rec, controls=controls)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If the backup command was run locally on the DC, then the backup-file should contain the DC&#039;s smb.conf. However, the smb.conf in the backup-file may contain &#039;interfaces&#039; configuration that doesn&#039;t match the IP addresses on the DC you&#039;re restoring on. If this happens, you&#039;ll get an error like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Looking up IPv4 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv4 address will be assigned&lt;br /&gt;
Looking up IPv6 addresses&lt;br /&gt;
WARNING: no network interfaces found&lt;br /&gt;
No IPv6 address will be assigned&lt;br /&gt;
ERROR: Please specify a host-ip for the new server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You can avoid this problem by specifying a &amp;lt;code&amp;gt;--host-ip&amp;lt;/code&amp;gt; argument during the restore. This should only affect rename backups.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Starting samba ==&lt;br /&gt;
&lt;br /&gt;
If you ran the backup as a non-root user, the restore will still succeed, but you&#039;ll hit errors when you try to start &amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;. E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo samba -s /tmp/online4/etc/smb.conf -i -d 3&lt;br /&gt;
samba version 4.10.0pre1-DEVELOPERBUILD started.&lt;br /&gt;
Copyright Andrew Tridgell and the Samba Team 1992-2018&lt;br /&gt;
...&lt;br /&gt;
directory_create_or_exist_strict: invalid ownership on directory /tmp/restore/private/msg.sock&lt;br /&gt;
exit_daemon: STATUS=daemon failed to start: Samba failed to setup parent messaging, error code -1073741801&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You could &amp;lt;tt&amp;gt;chown&amp;lt;/tt&amp;gt; your way out of this, but it&#039;s a lot simpler just to run the backup command as root.&lt;br /&gt;
&lt;br /&gt;
[[Category:Backup]] [[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=10053</id>
		<title>Sambaバックアップスクリプトを使用する</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=10053"/>
		<updated>2019-03-12T15:02:26Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: Meisina04 がページ「Samba AD DCのバックアップとリストア」を「Sambaバックアップスクリプトを使用する」に移動しました&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = このページはSamba v4.0-v4.8上でバックアップを作成することについて記載しています。Samba v4.9以降では、バックアップの作成が大幅に改善されました。詳細はこちらを参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
このドキュメントの内容は、samba 4.xで使用するためのものです。&lt;br /&gt;
&lt;br /&gt;
これは、Samba AD DCのバックアップと復元に関するチュートリアルです。それは有用であることが期待されていますが、保証は一切ありません ！&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;この行が削除されるまで、このドキュメントはDRAFTとみなされます。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== 一般 ==&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = 警告：複数のDCを動作させている場合：バックアップからDCを復元しないでください。レプリケーションのメタデータが同期 しなくなると、ディレクトリが破損します。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
少なくとも1つの他のDCがまだ動作している場合は、[[Samba DCを既存のActive Directoryに参加させる|新しいマシンをDCとして再び接続]]します。他の実行中のDCからすべてが同期されます - まだ実装されていないSysVolレプリケーションを除きます。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = 元のDC上でのみバックアップを使用し、新しいDCに移動してDCをアップグレードすることは絶対にしないでください。この場合、代わりに新しいDCに参加してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
ドメイン内のすべてのDCが壊れている場合は、http://lists.samba.orgのsamba-technicalメーリングリストに投稿して、これを解決する最善の 方法について議論する必要があります。&lt;br /&gt;
&lt;br /&gt;
=== LDBおよびTDBファイルのバックアップ/リストア方法 ===&lt;br /&gt;
&lt;br /&gt;
&#039;samba_backup&#039;スクリプトを修正する予定がある場合や独自のソリューションを作成する場合は、ここでいくつかの有益な情報を見つけるでしょう：&lt;br /&gt;
&lt;br /&gt;
* 実行中のデータベースを決してコピーする必要はありませんが、&amp;lt;code&amp;gt;* .ldb&amp;lt;/code&amp;gt;＆&amp;lt;code&amp;gt;* .tdb&amp;lt;/code&amp;gt;ファイルを&#039;tdbbackup&#039;でオンラ インでバックアップできます。&lt;br /&gt;
* tdbbackupによって作成されたファイルは、完全なTDBファイルと通常のTDBファイルです。 tdbbackupは安全に抽出を行います。&lt;br /&gt;
* &amp;lt;code&amp;gt;* .ldb&amp;lt;/code&amp;gt;ファイルのバックアップは、単に &#039;.bak&#039;というサフィックスを削除するだけで元の名前に復元できます。&lt;br /&gt;
&lt;br /&gt;
=== samba_backupスクリプトについて ===&lt;br /&gt;
&lt;br /&gt;
Sambaはデータベースをバックアップする非常に基本的なシェルスクリプトを提供しています（ソースtarballの&amp;lt;code&amp;gt;source4/scripting/bin/samba_backup&amp;lt;/code&amp;gt;）。これには、Sambaインストール全体が1つの場所にあることが必要です（&amp;lt;code&amp;gt;/usr /local/samba/&amp;lt;/code&amp;gt;など）。 configureオプションを使用して異なる場所にsambaを格納している場合は、スクリプトを調整するか、ベースとして使用して独自のスクリプトを作成 できます。&lt;br /&gt;
&lt;br /&gt;
スクリプトは非常に基本的なものであり、それをそのまま使用する予定がある場合、注意すべき点が1つあります。&lt;br /&gt;
&lt;br /&gt;
* スクリプトは拡張ACLをバックアップしません。したがって、あなたはパーミッションを失います（例：SysVol共有）。--xattrsオプションを サポートするtarバージョン（tarのマンページを参照）がある場合は、このオプションをスクリプト内のすべての &#039;tar&#039;コマンドに追加する必要があります。これにより、tarはアーカイブ内の拡張ACLを保持できます。&lt;br /&gt;
&lt;br /&gt;
== バックアップ ==&lt;br /&gt;
&lt;br /&gt;
Sambaのバックアップスクリプトは、 &#039;make install&#039;によってインストールされません。ソースディレクトリ（&amp;lt;code&amp;gt;source4/scripting/bin/samba_backup&amp;lt;/code&amp;gt;）から&amp;lt;code&amp;gt;/usr/sbin&amp;lt;/code&amp;gt;のような場所にコピーし、安全な権限を設定する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# cp .../source4/scripting/bin/samba_backup /usr/sbin&lt;br /&gt;
# chown root:root /usr/sbin/samba_backup&lt;br /&gt;
# chmod 750 /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
スクリプト内の以下の変数を必要に応じて調整します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;FROMWHERE=/usr/local/samba&lt;br /&gt;
WHERE=/usr/local/backups&lt;br /&gt;
DAYS=90&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$WHERE&amp;lt;/code&amp;gt;変数に設定してアクセス権を設定した宛先フォルダを作成します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# mkdir /usr/local/backups&lt;br /&gt;
# chmod 750 /usr/local/backups&amp;lt;/pre&amp;gt;&lt;br /&gt;
最初のテストのバックアップスクリプトを開始します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
スクリプトがエラーなしで終了する場合は、出力先フォルダに3つのファイルがあります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;etc.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;samba4_private.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sysvol.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
テストバックアップが成功した場合は、毎日のバックアップ用にcronジョブを追加する必要があります。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# crontab -e&amp;lt;/pre&amp;gt;&lt;br /&gt;
毎日2:00AMにバックアップするために、次の行を追加します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;0 2 * * *       /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
注意：cronを使用してスクリプトを実行するときは、すべての必要なバイナリが&amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;変数の一部であるディレクトリにあることを確認してください。正しいパスがシステム全体で定義されていない場合は、変数をcrontabに設定するか、またはスクリプトの先頭でshebang(#!)行の後に設定します。&lt;br /&gt;
&lt;br /&gt;
== リストア ==&lt;br /&gt;
&lt;br /&gt;
以下のリストアガイドでは、 &#039;samba_backup&#039;スクリプトを使用してデータベースをバックアップしたことを前提としています。独自のスクリプ トをお持ちの場合は、手順を調整してください。&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;非常に重要なメモ：&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;同時に、復元とバージョンの変更を行わないでください！バックアップを作成したものと同じSambaバージョンを使用しているシステムでは、常に復元してください！&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;同じIPとホスト名を持つシステムでは、常にリストアしてください。そうしないと、KerberosとDNSの問題が発生します。&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;推奨：バックアップを作成したのと同じOSで復元してください。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;復元状況で最も重要なことは、システムを実行状態に戻すことです。すべてアップしてテストされたら、必要な変更を行うことができます。 復元と一緒に変更しようとしないでください！&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
システム全体が壊れている場合は、まずHowTo（[[SambaをActive Directoryドメインコントローラとして設定する]]）の説明に従ってマシン全体をセットアップする必要があります。&lt;br /&gt;
&lt;br /&gt;
復元するフォルダを削除します（sambaは停止している状態で）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rm -rf /usr/local/samba/etc&lt;br /&gt;
# rm -rf /usr/local/samba/private&lt;br /&gt;
# rm -rf /usr/local/samba/var/locks/sysvol&amp;lt;/pre&amp;gt;&lt;br /&gt;
最新の作業用バックアップファイルを元の場所に展開します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# cd /usr/local/backups&lt;br /&gt;
# tar -jxf etc.{Timestamp}.tar.bz2 -C /usr/local/samba/&lt;br /&gt;
# tar -jxf samba4_private.{Timestamp}.tar.bz2 -C /usr/local/samba/&lt;br /&gt;
# tar -jxf sysvol.{Timestamp}.tar.bz2 -C /usr/local/samba/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt;ディレクトリの&amp;lt;code&amp;gt;*.ldb.bak&amp;lt;/code&amp;gt;ファイルの名前を&amp;lt;code&amp;gt;*.ldb&amp;lt;/code&amp;gt;に戻します。これはGNU &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; と&amp;lt;code&amp;gt;Bash&amp;lt;/code&amp;gt;で行うことができます：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# find /usr/local/samba/private/ -type f -name &#039;*.ldb.bak&#039; -print0 | while read -d $&#039;\0&#039; f ; do mv &amp;amp;quot;$f&amp;amp;quot; &amp;amp;quot;${f%.bak}&amp;amp;quot; ; done&amp;lt;/pre&amp;gt;&lt;br /&gt;
バックアップに拡張ACLが含まれていない場合（[[#samba_backupスクリプトについて|samba_backupスクリプトについて]]を参照）、以下を実行する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# samba-tool ntacl sysvolreset&amp;lt;/pre&amp;gt;&lt;br /&gt;
Bind as DNSバックエンドを使用する場合は、DNSデータベースのハードリンクを修正する必要があります。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# samba_upgradedns --dns-backend=BIND9_DLZ&amp;lt;/pre&amp;gt;&lt;br /&gt;
「[[BIND9 DLZ DNSバックエンド#新しいDNSエントリが解決できない|DNSバックエンド BIND - 新しいDNSバックエンドエントリが解決できない]]」 を参照してください。&lt;br /&gt;
&lt;br /&gt;
これで、sambaを起動し、復元が成功したかどうかをテストできます。&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ヒント&#039;&#039;&#039;：バックアップから単一のデータベースを復元することは可能ですが、一部のデータベースは他のデータベースにリンクされている可能性があるため、矛盾するシステムがないように注意してください。壊れたデータベースが他のデータベースに依存しているかどうか不明な場合は、http://lists.samba.orgの[mailto:samba-technical@lists.samba.org samba技術的]メーリングリストに問い合わせるか、すべてを復元する必要があります。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=10052</id>
		<title>Sambaバックアップスクリプトを使用する</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=10052"/>
		<updated>2019-03-12T14:53:04Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = このページはSamba v4.0-v4.8上でバックアップを作成することについて記載しています。Samba v4.9以降では、バックアップの作成が大幅に改善されました。詳細はこちらを参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
このドキュメントの内容は、samba 4.xで使用するためのものです。&lt;br /&gt;
&lt;br /&gt;
これは、Samba AD DCのバックアップと復元に関するチュートリアルです。それは有用であることが期待されていますが、保証は一切ありません ！&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;この行が削除されるまで、このドキュメントはDRAFTとみなされます。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== 一般 ==&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = 警告：複数のDCを動作させている場合：バックアップからDCを復元しないでください。レプリケーションのメタデータが同期 しなくなると、ディレクトリが破損します。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
少なくとも1つの他のDCがまだ動作している場合は、[[Samba DCを既存のActive Directoryに参加させる|新しいマシンをDCとして再び接続]]します。他の実行中のDCからすべてが同期されます - まだ実装されていないSysVolレプリケーションを除きます。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = 元のDC上でのみバックアップを使用し、新しいDCに移動してDCをアップグレードすることは絶対にしないでください。この場合、代わりに新しいDCに参加してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
ドメイン内のすべてのDCが壊れている場合は、http://lists.samba.orgのsamba-technicalメーリングリストに投稿して、これを解決する最善の 方法について議論する必要があります。&lt;br /&gt;
&lt;br /&gt;
=== LDBおよびTDBファイルのバックアップ/リストア方法 ===&lt;br /&gt;
&lt;br /&gt;
&#039;samba_backup&#039;スクリプトを修正する予定がある場合や独自のソリューションを作成する場合は、ここでいくつかの有益な情報を見つけるでしょう：&lt;br /&gt;
&lt;br /&gt;
* 実行中のデータベースを決してコピーする必要はありませんが、&amp;lt;code&amp;gt;* .ldb&amp;lt;/code&amp;gt;＆&amp;lt;code&amp;gt;* .tdb&amp;lt;/code&amp;gt;ファイルを&#039;tdbbackup&#039;でオンラ インでバックアップできます。&lt;br /&gt;
* tdbbackupによって作成されたファイルは、完全なTDBファイルと通常のTDBファイルです。 tdbbackupは安全に抽出を行います。&lt;br /&gt;
* &amp;lt;code&amp;gt;* .ldb&amp;lt;/code&amp;gt;ファイルのバックアップは、単に &#039;.bak&#039;というサフィックスを削除するだけで元の名前に復元できます。&lt;br /&gt;
&lt;br /&gt;
=== samba_backupスクリプトについて ===&lt;br /&gt;
&lt;br /&gt;
Sambaはデータベースをバックアップする非常に基本的なシェルスクリプトを提供しています（ソースtarballの&amp;lt;code&amp;gt;source4/scripting/bin/samba_backup&amp;lt;/code&amp;gt;）。これには、Sambaインストール全体が1つの場所にあることが必要です（&amp;lt;code&amp;gt;/usr /local/samba/&amp;lt;/code&amp;gt;など）。 configureオプションを使用して異なる場所にsambaを格納している場合は、スクリプトを調整するか、ベースとして使用して独自のスクリプトを作成 できます。&lt;br /&gt;
&lt;br /&gt;
スクリプトは非常に基本的なものであり、それをそのまま使用する予定がある場合、注意すべき点が1つあります。&lt;br /&gt;
&lt;br /&gt;
* スクリプトは拡張ACLをバックアップしません。したがって、あなたはパーミッションを失います（例：SysVol共有）。--xattrsオプションを サポートするtarバージョン（tarのマンページを参照）がある場合は、このオプションをスクリプト内のすべての &#039;tar&#039;コマンドに追加する必要があります。これにより、tarはアーカイブ内の拡張ACLを保持できます。&lt;br /&gt;
&lt;br /&gt;
== バックアップ ==&lt;br /&gt;
&lt;br /&gt;
Sambaのバックアップスクリプトは、 &#039;make install&#039;によってインストールされません。ソースディレクトリ（&amp;lt;code&amp;gt;source4/scripting/bin/samba_backup&amp;lt;/code&amp;gt;）から&amp;lt;code&amp;gt;/usr/sbin&amp;lt;/code&amp;gt;のような場所にコピーし、安全な権限を設定する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# cp .../source4/scripting/bin/samba_backup /usr/sbin&lt;br /&gt;
# chown root:root /usr/sbin/samba_backup&lt;br /&gt;
# chmod 750 /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
スクリプト内の以下の変数を必要に応じて調整します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;FROMWHERE=/usr/local/samba&lt;br /&gt;
WHERE=/usr/local/backups&lt;br /&gt;
DAYS=90&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$WHERE&amp;lt;/code&amp;gt;変数に設定してアクセス権を設定した宛先フォルダを作成します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# mkdir /usr/local/backups&lt;br /&gt;
# chmod 750 /usr/local/backups&amp;lt;/pre&amp;gt;&lt;br /&gt;
最初のテストのバックアップスクリプトを開始します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
スクリプトがエラーなしで終了する場合は、出力先フォルダに3つのファイルがあります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;etc.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;samba4_private.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sysvol.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
テストバックアップが成功した場合は、毎日のバックアップ用にcronジョブを追加する必要があります。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# crontab -e&amp;lt;/pre&amp;gt;&lt;br /&gt;
毎日2:00AMにバックアップするために、次の行を追加します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;0 2 * * *       /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
注意：cronを使用してスクリプトを実行するときは、すべての必要なバイナリが&amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;変数の一部であるディレクトリにあることを確認してください。正しいパスがシステム全体で定義されていない場合は、変数をcrontabに設定するか、またはスクリプトの先頭でshebang(#!)行の後に設定します。&lt;br /&gt;
&lt;br /&gt;
== リストア ==&lt;br /&gt;
&lt;br /&gt;
以下のリストアガイドでは、 &#039;samba_backup&#039;スクリプトを使用してデータベースをバックアップしたことを前提としています。独自のスクリプ トをお持ちの場合は、手順を調整してください。&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;非常に重要なメモ：&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;同時に、復元とバージョンの変更を行わないでください！バックアップを作成したものと同じSambaバージョンを使用しているシステムでは、常に復元してください！&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;同じIPとホスト名を持つシステムでは、常にリストアしてください。そうしないと、KerberosとDNSの問題が発生します。&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;推奨：バックアップを作成したのと同じOSで復元してください。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;復元状況で最も重要なことは、システムを実行状態に戻すことです。すべてアップしてテストされたら、必要な変更を行うことができます。 復元と一緒に変更しようとしないでください！&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
システム全体が壊れている場合は、まずHowTo（[[SambaをActive Directoryドメインコントローラとして設定する]]）の説明に従ってマシン全体をセットアップする必要があります。&lt;br /&gt;
&lt;br /&gt;
復元するフォルダを削除します（sambaは停止している状態で）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rm -rf /usr/local/samba/etc&lt;br /&gt;
# rm -rf /usr/local/samba/private&lt;br /&gt;
# rm -rf /usr/local/samba/var/locks/sysvol&amp;lt;/pre&amp;gt;&lt;br /&gt;
最新の作業用バックアップファイルを元の場所に展開します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# cd /usr/local/backups&lt;br /&gt;
# tar -jxf etc.{Timestamp}.tar.bz2 -C /usr/local/samba/&lt;br /&gt;
# tar -jxf samba4_private.{Timestamp}.tar.bz2 -C /usr/local/samba/&lt;br /&gt;
# tar -jxf sysvol.{Timestamp}.tar.bz2 -C /usr/local/samba/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt;ディレクトリの&amp;lt;code&amp;gt;*.ldb.bak&amp;lt;/code&amp;gt;ファイルの名前を&amp;lt;code&amp;gt;*.ldb&amp;lt;/code&amp;gt;に戻します。これはGNU &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; と&amp;lt;code&amp;gt;Bash&amp;lt;/code&amp;gt;で行うことができます：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# find /usr/local/samba/private/ -type f -name &#039;*.ldb.bak&#039; -print0 | while read -d $&#039;\0&#039; f ; do mv &amp;amp;quot;$f&amp;amp;quot; &amp;amp;quot;${f%.bak}&amp;amp;quot; ; done&amp;lt;/pre&amp;gt;&lt;br /&gt;
バックアップに拡張ACLが含まれていない場合（[[#samba_backupスクリプトについて|samba_backupスクリプトについて]]を参照）、以下を実行する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# samba-tool ntacl sysvolreset&amp;lt;/pre&amp;gt;&lt;br /&gt;
Bind as DNSバックエンドを使用する場合は、DNSデータベースのハードリンクを修正する必要があります。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# samba_upgradedns --dns-backend=BIND9_DLZ&amp;lt;/pre&amp;gt;&lt;br /&gt;
「[[BIND9 DLZ DNSバックエンド#新しいDNSエントリが解決できない|DNSバックエンド BIND - 新しいDNSバックエンドエントリが解決できない]]」 を参照してください。&lt;br /&gt;
&lt;br /&gt;
これで、sambaを起動し、復元が成功したかどうかをテストできます。&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ヒント&#039;&#039;&#039;：バックアップから単一のデータベースを復元することは可能ですが、一部のデータベースは他のデータベースにリンクされている可能性があるため、矛盾するシステムがないように注意してください。壊れたデータベースが他のデータベースに依存しているかどうか不明な場合は、http://lists.samba.orgの[mailto:samba-technical@lists.samba.org samba技術的]メーリングリストに問い合わせるか、すべてを復元する必要があります。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=10051</id>
		<title>Sambaバックアップスクリプトを使用する</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=10051"/>
		<updated>2019-03-12T14:52:38Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* はじめに */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
: {{Imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| text = このページはSamba v4.0-v4.8上でバックアップを作成することについて記載しています。Samba v4.9以降では、バックアップの作成が大幅に改善されました。詳細はこちらを参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
このドキュメントの内容は、samba 4.xで使用するためのものです。&lt;br /&gt;
&lt;br /&gt;
これは、Samba AD DCのバックアップと復元に関するチュートリアルです。それは有用であることが期待されていますが、保証は一切ありません ！&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;この行が削除されるまで、このドキュメントはDRAFTとみなされます。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== 一般 ==&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| type = content&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = 警告：複数のDCを動作させている場合：バックアップからDCを復元しないでください。レプリケーションのメタデータが同期 しなくなると、ディレクトリが破損します。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
少なくとも1つの他のDCがまだ動作している場合は、[[Samba DCを既存のActive Directoryに参加させる|新しいマシンをDCとして再び接続]]します。他の実行中のDCからすべてが同期されます - まだ実装されていないSysVolレプリケーションを除きます。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = 元のDC上でのみバックアップを使用し、新しいDCに移動してDCをアップグレードすることは絶対にしないでください。この場合、代わりに新しいDCに参加してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
ドメイン内のすべてのDCが壊れている場合は、http://lists.samba.orgのsamba-technicalメーリングリストに投稿して、これを解決する最善の 方法について議論する必要があります。&lt;br /&gt;
&lt;br /&gt;
=== LDBおよびTDBファイルのバックアップ/リストア方法 ===&lt;br /&gt;
&lt;br /&gt;
&#039;samba_backup&#039;スクリプトを修正する予定がある場合や独自のソリューションを作成する場合は、ここでいくつかの有益な情報を見つけるでしょう：&lt;br /&gt;
&lt;br /&gt;
* 実行中のデータベースを決してコピーする必要はありませんが、&amp;lt;code&amp;gt;* .ldb&amp;lt;/code&amp;gt;＆&amp;lt;code&amp;gt;* .tdb&amp;lt;/code&amp;gt;ファイルを&#039;tdbbackup&#039;でオンラ インでバックアップできます。&lt;br /&gt;
* tdbbackupによって作成されたファイルは、完全なTDBファイルと通常のTDBファイルです。 tdbbackupは安全に抽出を行います。&lt;br /&gt;
* &amp;lt;code&amp;gt;* .ldb&amp;lt;/code&amp;gt;ファイルのバックアップは、単に &#039;.bak&#039;というサフィックスを削除するだけで元の名前に復元できます。&lt;br /&gt;
&lt;br /&gt;
=== samba_backupスクリプトについて ===&lt;br /&gt;
&lt;br /&gt;
Sambaはデータベースをバックアップする非常に基本的なシェルスクリプトを提供しています（ソースtarballの&amp;lt;code&amp;gt;source4/scripting/bin/samba_backup&amp;lt;/code&amp;gt;）。これには、Sambaインストール全体が1つの場所にあることが必要です（&amp;lt;code&amp;gt;/usr /local/samba/&amp;lt;/code&amp;gt;など）。 configureオプションを使用して異なる場所にsambaを格納している場合は、スクリプトを調整するか、ベースとして使用して独自のスクリプトを作成 できます。&lt;br /&gt;
&lt;br /&gt;
スクリプトは非常に基本的なものであり、それをそのまま使用する予定がある場合、注意すべき点が1つあります。&lt;br /&gt;
&lt;br /&gt;
* スクリプトは拡張ACLをバックアップしません。したがって、あなたはパーミッションを失います（例：SysVol共有）。--xattrsオプションを サポートするtarバージョン（tarのマンページを参照）がある場合は、このオプションをスクリプト内のすべての &#039;tar&#039;コマンドに追加する必要があります。これにより、tarはアーカイブ内の拡張ACLを保持できます。&lt;br /&gt;
&lt;br /&gt;
== バックアップ ==&lt;br /&gt;
&lt;br /&gt;
Sambaのバックアップスクリプトは、 &#039;make install&#039;によってインストールされません。ソースディレクトリ（&amp;lt;code&amp;gt;source4/scripting/bin/samba_backup&amp;lt;/code&amp;gt;）から&amp;lt;code&amp;gt;/usr/sbin&amp;lt;/code&amp;gt;のような場所にコピーし、安全な権限を設定する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# cp .../source4/scripting/bin/samba_backup /usr/sbin&lt;br /&gt;
# chown root:root /usr/sbin/samba_backup&lt;br /&gt;
# chmod 750 /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
スクリプト内の以下の変数を必要に応じて調整します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;FROMWHERE=/usr/local/samba&lt;br /&gt;
WHERE=/usr/local/backups&lt;br /&gt;
DAYS=90&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$WHERE&amp;lt;/code&amp;gt;変数に設定してアクセス権を設定した宛先フォルダを作成します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# mkdir /usr/local/backups&lt;br /&gt;
# chmod 750 /usr/local/backups&amp;lt;/pre&amp;gt;&lt;br /&gt;
最初のテストのバックアップスクリプトを開始します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
スクリプトがエラーなしで終了する場合は、出力先フォルダに3つのファイルがあります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;etc.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;samba4_private.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sysvol.{Timestamp}.tar.bz2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
テストバックアップが成功した場合は、毎日のバックアップ用にcronジョブを追加する必要があります。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# crontab -e&amp;lt;/pre&amp;gt;&lt;br /&gt;
毎日2:00AMにバックアップするために、次の行を追加します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;0 2 * * *       /usr/sbin/samba_backup&amp;lt;/pre&amp;gt;&lt;br /&gt;
注意：cronを使用してスクリプトを実行するときは、すべての必要なバイナリが&amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;変数の一部であるディレクトリにあることを確認してください。正しいパスがシステム全体で定義されていない場合は、変数をcrontabに設定するか、またはスクリプトの先頭でshebang(#!)行の後に設定します。&lt;br /&gt;
&lt;br /&gt;
== リストア ==&lt;br /&gt;
&lt;br /&gt;
以下のリストアガイドでは、 &#039;samba_backup&#039;スクリプトを使用してデータベースをバックアップしたことを前提としています。独自のスクリプ トをお持ちの場合は、手順を調整してください。&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;非常に重要なメモ：&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;同時に、復元とバージョンの変更を行わないでください！バックアップを作成したものと同じSambaバージョンを使用しているシステムでは、常に復元してください！&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;同じIPとホスト名を持つシステムでは、常にリストアしてください。そうしないと、KerberosとDNSの問題が発生します。&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;推奨：バックアップを作成したのと同じOSで復元してください。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;復元状況で最も重要なことは、システムを実行状態に戻すことです。すべてアップしてテストされたら、必要な変更を行うことができます。 復元と一緒に変更しようとしないでください！&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
システム全体が壊れている場合は、まずHowTo（[[SambaをActive Directoryドメインコントローラとして設定する]]）の説明に従ってマシン全体をセットアップする必要があります。&lt;br /&gt;
&lt;br /&gt;
復元するフォルダを削除します（sambaは停止している状態で）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rm -rf /usr/local/samba/etc&lt;br /&gt;
# rm -rf /usr/local/samba/private&lt;br /&gt;
# rm -rf /usr/local/samba/var/locks/sysvol&amp;lt;/pre&amp;gt;&lt;br /&gt;
最新の作業用バックアップファイルを元の場所に展開します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# cd /usr/local/backups&lt;br /&gt;
# tar -jxf etc.{Timestamp}.tar.bz2 -C /usr/local/samba/&lt;br /&gt;
# tar -jxf samba4_private.{Timestamp}.tar.bz2 -C /usr/local/samba/&lt;br /&gt;
# tar -jxf sysvol.{Timestamp}.tar.bz2 -C /usr/local/samba/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt;ディレクトリの&amp;lt;code&amp;gt;*.ldb.bak&amp;lt;/code&amp;gt;ファイルの名前を&amp;lt;code&amp;gt;*.ldb&amp;lt;/code&amp;gt;に戻します。これはGNU &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; と&amp;lt;code&amp;gt;Bash&amp;lt;/code&amp;gt;で行うことができます：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# find /usr/local/samba/private/ -type f -name &#039;*.ldb.bak&#039; -print0 | while read -d $&#039;\0&#039; f ; do mv &amp;amp;quot;$f&amp;amp;quot; &amp;amp;quot;${f%.bak}&amp;amp;quot; ; done&amp;lt;/pre&amp;gt;&lt;br /&gt;
バックアップに拡張ACLが含まれていない場合（[[#samba_backupスクリプトについて|samba_backupスクリプトについて]]を参照）、以下を実行する必要があります：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# samba-tool ntacl sysvolreset&amp;lt;/pre&amp;gt;&lt;br /&gt;
Bind as DNSバックエンドを使用する場合は、DNSデータベースのハードリンクを修正する必要があります。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# samba_upgradedns --dns-backend=BIND9_DLZ&amp;lt;/pre&amp;gt;&lt;br /&gt;
「[[BIND9 DLZ DNSバックエンド#新しいDNSエントリが解決できない|DNSバックエンド BIND - 新しいDNSバックエンドエントリが解決できない]]」 を参照してください。&lt;br /&gt;
&lt;br /&gt;
これで、sambaを起動し、復元が成功したかどうかをテストできます。&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ヒント&#039;&#039;&#039;：バックアップから単一のデータベースを復元することは可能ですが、一部のデータベースは他のデータベースにリンクされている可能性があるため、矛盾するシステムがないように注意してください。壊れたデータベースが他のデータベースに依存しているかどうか不明な場合は、http://lists.samba.orgの[mailto:samba-technical@lists.samba.org samba技術的]メーリングリストに問い合わせるか、すべてを復元する必要があります。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10050</id>
		<title>RsyncベースのSysvolレプリケーションの回避策</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10050"/>
		<updated>2019-03-12T14:20:27Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* その他のドメインコントローラの設定 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
Samba ADは現在、SysVolレプリケーションのサポートを提供していません。 Multi-DC環境でこの重要な機能を実現するには、実装するまで、同 期を維持するための回避策が必要です。このHowToは、rsyncに基づいた基本的な回避策のソリューションを提供します。&lt;br /&gt;
&lt;br /&gt;
== rsyncベースのレプリケーションに関する情報 ==&lt;br /&gt;
&lt;br /&gt;
[[Image:DC_PDC_emulator.png|thumb|PDCのためのグループポリシー管理コンソールのオプション]]&lt;br /&gt;
&lt;br /&gt;
このHowToでは、rsyncに基づいたSysVolレプリケーションのソリューションについて説明します。このツールは一方向です。つまり、ファイルは一方向にしか転送できません。そのため、rsyncベースのSysVolレプリケーションでは、すべての変更（GPO編集、ログオンスクリプトの変更など）を行うDCを1つ選択する必要があります。他のすべてのDCはこのホストからの変更を取得します。これは、同期時に変更が上書きされるためで す。&lt;br /&gt;
&lt;br /&gt;
「マスター」ホストの良い選択は、FSMOの「PDCエミュレータ」を含む一台です。なぜなら、他のDCのいずれかを選択するのではなく、このコン ピュータのみに接続するようににグループポリシー管理コンソールを構成できるからです（既定）。GPMCが接続するコンピュータの「アクション」／「ドメインコントローラの変更」で定義できます。そこでは「PDCエミュレータ用の操作マスタートークンをもつドメインコントローラ」（ デフォルト）を選択する必要があります。&lt;br /&gt;
&lt;br /&gt;
rsyncの単一方向のレプリケーションは制限がありますが、多くの利点もあります。&lt;br /&gt;
&lt;br /&gt;
* ほとんどのディストリビューションで既に利用可能であり、パッケージマネージャを使用してインストールすることもできます（まだインストールされていない場合）&lt;br /&gt;
* 非常に迅速にセットアップできます&lt;br /&gt;
* 非常に簡単に設定できます&lt;br /&gt;
* 等々&lt;br /&gt;
&lt;br /&gt;
rsyncをSSHトンネル経由で使用する場合は、必要に応じてコマンドを適用できますが、通常はSysVol共有に機密コンテンツはありません。ほとんどの場合、暗号化されていない転送を使用するだけで十分です。 PDCエミュレータ上のrsyncモジュールもソースとしてのみ使用されるため、読み取り専用と して定義されているため、コンテンツをプッシュすることはできません。&lt;br /&gt;
&lt;br /&gt;
== Sysvolレプリケーションを設定する ==&lt;br /&gt;
&lt;br /&gt;
=== PCDエミュレータFSMOロールをもつドメインコントローラでの設定 ===&lt;br /&gt;
&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* もし、xinetdを通してrsyncサーバを開始するのであれば、以下の設定ファイルを使用できます（&amp;lt;code&amp;gt;/etc/xinetd.d/rsync&amp;lt;/code&amp;gt;）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;service rsync&lt;br /&gt;
{&lt;br /&gt;
   disable         = no&lt;br /&gt;
   only_from       = 10.99.0.0/28     # Restrict to your DC address(es) or ranges, to prevent other hosts retrieving the content, too.&lt;br /&gt;
   socket_type     = stream&lt;br /&gt;
   wait            = no&lt;br /&gt;
   user            = root&lt;br /&gt;
   server          = /usr/bin/rsync&lt;br /&gt;
   server_args     = --daemon&lt;br /&gt;
   log_on_failure += USERID&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;/etc/rsyncd.conf&amp;lt;/code&amp;gt;を作成（path変数はPDCエミュレータのSysvolのパスに適合させてください）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[SysVol]&lt;br /&gt;
path = /usr/local/samba/var/locks/sysvol/&lt;br /&gt;
comment = Samba Sysvol Share&lt;br /&gt;
uid = root&lt;br /&gt;
gid = root&lt;br /&gt;
read only = yes&lt;br /&gt;
auth users = sysvol-replication&lt;br /&gt;
secrets file = /usr/local/samba/etc/rsyncd.secret&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 以下の内容（パスワードはそちらに合わせて改変してください）で&amp;lt;code&amp;gt;/usr/local/samba/etc/rsyncd.secret&amp;lt;/code&amp;gt;ファイルを作成してく ださい（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysvol-replication:pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;xinetd&amp;lt;/code&amp;gt;を再スタートしてください。&lt;br /&gt;
&lt;br /&gt;
=== その他のドメインコントローラの設定 ===&lt;br /&gt;
&lt;br /&gt;
* [[ Samba_DCを既存のActive_Directoryに参加させる#ビルトインユーザーとグループIDのマッピング|全てのDCでビルトイングループが同一のIDを持っていること]]を確認してください。&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* パスワードファイル&amp;lt;code&amp;gt;/usr/local/samba/etc/rsync-sysvol.secret&amp;lt;/code&amp;gt;を作成し、あなたがsysvolレプリケーションのrsyncアカウント用のPDCエミュレータでセットしたパスワードで埋めて下さい。（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Sysvolフォルダーを複製するために、以下のコマンドを実行して下さい（&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;は実際に変更が加えられないことを意味します）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rsync --dry-run -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-your-PDC-Emurator}/SysVol/ /path/to/your/sysvol/folder/&lt;br /&gt;
&lt;br /&gt;
receiving file list ... done                                                                                                      &lt;br /&gt;
created directory /usr/local/samba/var/locks/sysvol                                                                               &lt;br /&gt;
./                                                                                                                                &lt;br /&gt;
samdom.example.com/                                                                                                               &lt;br /&gt;
samdom.example.com/Policies/                                                                                                      &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/                                                               &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/GPT.INI                                                        &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/                                                       &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Registry.pol                                           &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/                                                          &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Documents &amp;amp;amp; Settings/                                 &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/                                                  &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logoff/&lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logon/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/GPT.INI&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/MACHINE/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/USER/&lt;br /&gt;
samdom.example.com/scripts/&lt;br /&gt;
samdom.example.com/scripts/logonscript.bat&lt;br /&gt;
&lt;br /&gt;
sent 124 bytes  received 1064 bytes  2376.00 bytes/sec&lt;br /&gt;
total size is 1207  speedup is 1.02 (DRY RUN)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;警告：宛先のフォルダが本当にSysvolフォルダーであるか確認してください。コマンドは指定されたディレクトリに複製し、なおかつソース にないものは全て削除されます。システムにダメージを与える可能性があります。ですので、レプリケーションが期待通りに動作しているか確認するために、出力を注意深くチェックして下さい。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* すべて正常に動作しているのであれば、&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;オプションなしでコマンドを実行し、&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;にレプリケーション実行させます。&lt;br /&gt;
* 自動的に同期できるように、コマンドを&amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt;で実行してください（例えば、5分毎に）。&lt;br /&gt;
&lt;br /&gt;
 */5 * * * *          rsync -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-your-PDC-Emulator}/SysVol/ /path/to/your/sysvol/folder/&lt;br /&gt;
&lt;br /&gt;
* これらのステップを全てのDCで繰り返して下さい（PDCは除く）。&lt;br /&gt;
&lt;br /&gt;
== FAQ ==&lt;br /&gt;
&lt;br /&gt;
* どのようにすれば、複数方向のレプリケーションを実行できますか？&lt;br /&gt;
:* これを実現するために、unisonとrsyncを使用しているテストがいくつかあります。&lt;br /&gt;
:* ここを見て下さい：&lt;br /&gt;
:* https://wiki.samba.org/index.php/Bidirectional_Rsync/Unison_based_SysVol_replication_workaround&lt;br /&gt;
* なぜ、SysvolのためにGlusterFS、Lustreなどの分散型ファイルシステムをシンプルに使えないのですか？&lt;br /&gt;
:* Sambaを使用するクラスタファイルシステムでは、CTDBを安全に実行する必要があります。それに、CTDBとAD DCは互換性がありません。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10049</id>
		<title>RsyncベースのSysvolレプリケーションの回避策</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10049"/>
		<updated>2019-03-12T14:18:18Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* その他のドメインコントローラの設定 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
Samba ADは現在、SysVolレプリケーションのサポートを提供していません。 Multi-DC環境でこの重要な機能を実現するには、実装するまで、同 期を維持するための回避策が必要です。このHowToは、rsyncに基づいた基本的な回避策のソリューションを提供します。&lt;br /&gt;
&lt;br /&gt;
== rsyncベースのレプリケーションに関する情報 ==&lt;br /&gt;
&lt;br /&gt;
[[Image:DC_PDC_emulator.png|thumb|PDCのためのグループポリシー管理コンソールのオプション]]&lt;br /&gt;
&lt;br /&gt;
このHowToでは、rsyncに基づいたSysVolレプリケーションのソリューションについて説明します。このツールは一方向です。つまり、ファイルは一方向にしか転送できません。そのため、rsyncベースのSysVolレプリケーションでは、すべての変更（GPO編集、ログオンスクリプトの変更など）を行うDCを1つ選択する必要があります。他のすべてのDCはこのホストからの変更を取得します。これは、同期時に変更が上書きされるためで す。&lt;br /&gt;
&lt;br /&gt;
「マスター」ホストの良い選択は、FSMOの「PDCエミュレータ」を含む一台です。なぜなら、他のDCのいずれかを選択するのではなく、このコン ピュータのみに接続するようににグループポリシー管理コンソールを構成できるからです（既定）。GPMCが接続するコンピュータの「アクション」／「ドメインコントローラの変更」で定義できます。そこでは「PDCエミュレータ用の操作マスタートークンをもつドメインコントローラ」（ デフォルト）を選択する必要があります。&lt;br /&gt;
&lt;br /&gt;
rsyncの単一方向のレプリケーションは制限がありますが、多くの利点もあります。&lt;br /&gt;
&lt;br /&gt;
* ほとんどのディストリビューションで既に利用可能であり、パッケージマネージャを使用してインストールすることもできます（まだインストールされていない場合）&lt;br /&gt;
* 非常に迅速にセットアップできます&lt;br /&gt;
* 非常に簡単に設定できます&lt;br /&gt;
* 等々&lt;br /&gt;
&lt;br /&gt;
rsyncをSSHトンネル経由で使用する場合は、必要に応じてコマンドを適用できますが、通常はSysVol共有に機密コンテンツはありません。ほとんどの場合、暗号化されていない転送を使用するだけで十分です。 PDCエミュレータ上のrsyncモジュールもソースとしてのみ使用されるため、読み取り専用と して定義されているため、コンテンツをプッシュすることはできません。&lt;br /&gt;
&lt;br /&gt;
== Sysvolレプリケーションを設定する ==&lt;br /&gt;
&lt;br /&gt;
=== PCDエミュレータFSMOロールをもつドメインコントローラでの設定 ===&lt;br /&gt;
&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* もし、xinetdを通してrsyncサーバを開始するのであれば、以下の設定ファイルを使用できます（&amp;lt;code&amp;gt;/etc/xinetd.d/rsync&amp;lt;/code&amp;gt;）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;service rsync&lt;br /&gt;
{&lt;br /&gt;
   disable         = no&lt;br /&gt;
   only_from       = 10.99.0.0/28     # Restrict to your DC address(es) or ranges, to prevent other hosts retrieving the content, too.&lt;br /&gt;
   socket_type     = stream&lt;br /&gt;
   wait            = no&lt;br /&gt;
   user            = root&lt;br /&gt;
   server          = /usr/bin/rsync&lt;br /&gt;
   server_args     = --daemon&lt;br /&gt;
   log_on_failure += USERID&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;/etc/rsyncd.conf&amp;lt;/code&amp;gt;を作成（path変数はPDCエミュレータのSysvolのパスに適合させてください）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[SysVol]&lt;br /&gt;
path = /usr/local/samba/var/locks/sysvol/&lt;br /&gt;
comment = Samba Sysvol Share&lt;br /&gt;
uid = root&lt;br /&gt;
gid = root&lt;br /&gt;
read only = yes&lt;br /&gt;
auth users = sysvol-replication&lt;br /&gt;
secrets file = /usr/local/samba/etc/rsyncd.secret&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 以下の内容（パスワードはそちらに合わせて改変してください）で&amp;lt;code&amp;gt;/usr/local/samba/etc/rsyncd.secret&amp;lt;/code&amp;gt;ファイルを作成してく ださい（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysvol-replication:pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;xinetd&amp;lt;/code&amp;gt;を再スタートしてください。&lt;br /&gt;
&lt;br /&gt;
=== その他のドメインコントローラの設定 ===&lt;br /&gt;
&lt;br /&gt;
* [[ Samba_DCを既存のActive_Directoryに参加させる#ビルトインユーザーとグループIDのマッピング|全てのDCでビルトイングループが同一のIDを持っていること]]を確認してください。&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* パスワードファイル&amp;lt;code&amp;gt;/usr/local/samba/etc/rsync-sysvol.secret&amp;lt;/code&amp;gt;を作成し、あなたがsysvolレプリケーションのrsyncアカウント用のPDCエミュレータでセットしたパスワードで埋めて下さい。（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Sysvolフォルダーを複製するために、以下のコマンドを実行して下さい（&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;は実際に変更が加えられないことを意味します）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rsync --dry-run -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&lt;br /&gt;
&lt;br /&gt;
receiving file list ... done                                                                                                      &lt;br /&gt;
created directory /usr/local/samba/var/locks/sysvol                                                                               &lt;br /&gt;
./                                                                                                                                &lt;br /&gt;
samdom.example.com/                                                                                                               &lt;br /&gt;
samdom.example.com/Policies/                                                                                                      &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/                                                               &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/GPT.INI                                                        &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/                                                       &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Registry.pol                                           &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/                                                          &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Documents &amp;amp;amp; Settings/                                 &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/                                                  &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logoff/&lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logon/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/GPT.INI&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/MACHINE/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/USER/&lt;br /&gt;
samdom.example.com/scripts/&lt;br /&gt;
samdom.example.com/scripts/logonscript.bat&lt;br /&gt;
&lt;br /&gt;
sent 124 bytes  received 1064 bytes  2376.00 bytes/sec&lt;br /&gt;
total size is 1207  speedup is 1.02 (DRY RUN)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;警告：宛先のフォルダが本当にSysvolフォルダーであるか確認してください。コマンドは指定されたディレクトリに複製し、なおかつソース にないものは全て削除されます。システムにダメージを与える可能性があります。ですので、レプリケーションが期待通りに動作しているか確認するために、出力を注意深くチェックして下さい。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* すべて正常に動作しているのであれば、&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;オプションなしでコマンドを実行し、&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;にレプリケーション実行させます。&lt;br /&gt;
* 自動的に同期できるように、コマンドを&amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt;で実行してください（例えば、5分毎に）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;*/5 * * * *          rsync -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-your-PDC-Emulator}/SysVol/ /path/to/your/sysvol/folder/&amp;lt;/pre&amp;gt;&lt;br /&gt;
* これらのステップを全てのDCで繰り返して下さい（PDCは除く）。&lt;br /&gt;
&lt;br /&gt;
== FAQ ==&lt;br /&gt;
&lt;br /&gt;
* どのようにすれば、複数方向のレプリケーションを実行できますか？&lt;br /&gt;
:* これを実現するために、unisonとrsyncを使用しているテストがいくつかあります。&lt;br /&gt;
:* ここを見て下さい：&lt;br /&gt;
:* https://wiki.samba.org/index.php/Bidirectional_Rsync/Unison_based_SysVol_replication_workaround&lt;br /&gt;
* なぜ、SysvolのためにGlusterFS、Lustreなどの分散型ファイルシステムをシンプルに使えないのですか？&lt;br /&gt;
:* Sambaを使用するクラスタファイルシステムでは、CTDBを安全に実行する必要があります。それに、CTDBとAD DCは互換性がありません。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10048</id>
		<title>RsyncベースのSysvolレプリケーションの回避策</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10048"/>
		<updated>2019-03-12T14:17:06Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* その他のドメインコントローラの設定 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
Samba ADは現在、SysVolレプリケーションのサポートを提供していません。 Multi-DC環境でこの重要な機能を実現するには、実装するまで、同 期を維持するための回避策が必要です。このHowToは、rsyncに基づいた基本的な回避策のソリューションを提供します。&lt;br /&gt;
&lt;br /&gt;
== rsyncベースのレプリケーションに関する情報 ==&lt;br /&gt;
&lt;br /&gt;
[[Image:DC_PDC_emulator.png|thumb|PDCのためのグループポリシー管理コンソールのオプション]]&lt;br /&gt;
&lt;br /&gt;
このHowToでは、rsyncに基づいたSysVolレプリケーションのソリューションについて説明します。このツールは一方向です。つまり、ファイルは一方向にしか転送できません。そのため、rsyncベースのSysVolレプリケーションでは、すべての変更（GPO編集、ログオンスクリプトの変更など）を行うDCを1つ選択する必要があります。他のすべてのDCはこのホストからの変更を取得します。これは、同期時に変更が上書きされるためで す。&lt;br /&gt;
&lt;br /&gt;
「マスター」ホストの良い選択は、FSMOの「PDCエミュレータ」を含む一台です。なぜなら、他のDCのいずれかを選択するのではなく、このコン ピュータのみに接続するようににグループポリシー管理コンソールを構成できるからです（既定）。GPMCが接続するコンピュータの「アクション」／「ドメインコントローラの変更」で定義できます。そこでは「PDCエミュレータ用の操作マスタートークンをもつドメインコントローラ」（ デフォルト）を選択する必要があります。&lt;br /&gt;
&lt;br /&gt;
rsyncの単一方向のレプリケーションは制限がありますが、多くの利点もあります。&lt;br /&gt;
&lt;br /&gt;
* ほとんどのディストリビューションで既に利用可能であり、パッケージマネージャを使用してインストールすることもできます（まだインストールされていない場合）&lt;br /&gt;
* 非常に迅速にセットアップできます&lt;br /&gt;
* 非常に簡単に設定できます&lt;br /&gt;
* 等々&lt;br /&gt;
&lt;br /&gt;
rsyncをSSHトンネル経由で使用する場合は、必要に応じてコマンドを適用できますが、通常はSysVol共有に機密コンテンツはありません。ほとんどの場合、暗号化されていない転送を使用するだけで十分です。 PDCエミュレータ上のrsyncモジュールもソースとしてのみ使用されるため、読み取り専用と して定義されているため、コンテンツをプッシュすることはできません。&lt;br /&gt;
&lt;br /&gt;
== Sysvolレプリケーションを設定する ==&lt;br /&gt;
&lt;br /&gt;
=== PCDエミュレータFSMOロールをもつドメインコントローラでの設定 ===&lt;br /&gt;
&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* もし、xinetdを通してrsyncサーバを開始するのであれば、以下の設定ファイルを使用できます（&amp;lt;code&amp;gt;/etc/xinetd.d/rsync&amp;lt;/code&amp;gt;）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;service rsync&lt;br /&gt;
{&lt;br /&gt;
   disable         = no&lt;br /&gt;
   only_from       = 10.99.0.0/28     # Restrict to your DC address(es) or ranges, to prevent other hosts retrieving the content, too.&lt;br /&gt;
   socket_type     = stream&lt;br /&gt;
   wait            = no&lt;br /&gt;
   user            = root&lt;br /&gt;
   server          = /usr/bin/rsync&lt;br /&gt;
   server_args     = --daemon&lt;br /&gt;
   log_on_failure += USERID&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;/etc/rsyncd.conf&amp;lt;/code&amp;gt;を作成（path変数はPDCエミュレータのSysvolのパスに適合させてください）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[SysVol]&lt;br /&gt;
path = /usr/local/samba/var/locks/sysvol/&lt;br /&gt;
comment = Samba Sysvol Share&lt;br /&gt;
uid = root&lt;br /&gt;
gid = root&lt;br /&gt;
read only = yes&lt;br /&gt;
auth users = sysvol-replication&lt;br /&gt;
secrets file = /usr/local/samba/etc/rsyncd.secret&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 以下の内容（パスワードはそちらに合わせて改変してください）で&amp;lt;code&amp;gt;/usr/local/samba/etc/rsyncd.secret&amp;lt;/code&amp;gt;ファイルを作成してく ださい（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysvol-replication:pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;xinetd&amp;lt;/code&amp;gt;を再スタートしてください。&lt;br /&gt;
&lt;br /&gt;
=== その他のドメインコントローラの設定 ===&lt;br /&gt;
&lt;br /&gt;
* [[ Samba_DCを既存のActive_Directoryに参加させる#ビルトインユーザーとグループIDのマッピング|全てのDCでビルトイングループが同一のIDを持っていること]]を確認してください。&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* パスワードファイル&amp;lt;code&amp;gt;/usr/local/samba/etc/rsync-sysvol.secret&amp;lt;/code&amp;gt;を作成し、あなたがsysvolレプリケーションのrsyncアカウント用のPDCエミュレータでセットしたパスワードで埋めて下さい。（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Sysvolフォルダーを複製するために、以下のコマンドを実行して下さい（&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;は実際に変更が加えられないことを意味します）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rsync --dry-run -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&lt;br /&gt;
&lt;br /&gt;
receiving file list ... done                                                                                                      &lt;br /&gt;
created directory /usr/local/samba/var/locks/sysvol                                                                               &lt;br /&gt;
./                                                                                                                                &lt;br /&gt;
samdom.example.com/                                                                                                               &lt;br /&gt;
samdom.example.com/Policies/                                                                                                      &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/                                                               &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/GPT.INI                                                        &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/                                                       &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Registry.pol                                           &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/                                                          &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Documents &amp;amp;amp; Settings/                                 &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/                                                  &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logoff/&lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logon/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/GPT.INI&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/MACHINE/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/USER/&lt;br /&gt;
samdom.example.com/scripts/&lt;br /&gt;
samdom.example.com/scripts/logonscript.bat&lt;br /&gt;
&lt;br /&gt;
sent 124 bytes  received 1064 bytes  2376.00 bytes/sec&lt;br /&gt;
total size is 1207  speedup is 1.02 (DRY RUN)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;警告：宛先のフォルダが本当にSysvolフォルダーであるか確認してください。コマンドは指定されたディレクトリに複製し、なおかつソース にないものは全て削除されます。システムにダメージを与える可能性があります。ですので、レプリケーションが期待通りに動作しているか確認するために、出力を注意深くチェックして下さい。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* すべて正常に動作しているのであれば、&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;オプションなしでコマンドを実行し、&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;にレプリケーション実行させます。&lt;br /&gt;
* 自動的に同期できるように、コマンドを&amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt;で実行してください（例えば、5分毎に）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;*/5 * * * *          rsync -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&amp;lt;/pre&amp;gt;&lt;br /&gt;
* これらのステップを全てのDCで繰り返して下さい（PDCは除く）。&lt;br /&gt;
&lt;br /&gt;
== FAQ ==&lt;br /&gt;
&lt;br /&gt;
* どのようにすれば、複数方向のレプリケーションを実行できますか？&lt;br /&gt;
:* これを実現するために、unisonとrsyncを使用しているテストがいくつかあります。&lt;br /&gt;
:* ここを見て下さい：&lt;br /&gt;
:* https://wiki.samba.org/index.php/Bidirectional_Rsync/Unison_based_SysVol_replication_workaround&lt;br /&gt;
* なぜ、SysvolのためにGlusterFS、Lustreなどの分散型ファイルシステムをシンプルに使えないのですか？&lt;br /&gt;
:* Sambaを使用するクラスタファイルシステムでは、CTDBを安全に実行する必要があります。それに、CTDBとAD DCは互換性がありません。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10047</id>
		<title>RsyncベースのSysvolレプリケーションの回避策</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10047"/>
		<updated>2019-03-12T14:16:11Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* その他のドメインコントローラの設定 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
Samba ADは現在、SysVolレプリケーションのサポートを提供していません。 Multi-DC環境でこの重要な機能を実現するには、実装するまで、同 期を維持するための回避策が必要です。このHowToは、rsyncに基づいた基本的な回避策のソリューションを提供します。&lt;br /&gt;
&lt;br /&gt;
== rsyncベースのレプリケーションに関する情報 ==&lt;br /&gt;
&lt;br /&gt;
[[Image:DC_PDC_emulator.png|thumb|PDCのためのグループポリシー管理コンソールのオプション]]&lt;br /&gt;
&lt;br /&gt;
このHowToでは、rsyncに基づいたSysVolレプリケーションのソリューションについて説明します。このツールは一方向です。つまり、ファイルは一方向にしか転送できません。そのため、rsyncベースのSysVolレプリケーションでは、すべての変更（GPO編集、ログオンスクリプトの変更など）を行うDCを1つ選択する必要があります。他のすべてのDCはこのホストからの変更を取得します。これは、同期時に変更が上書きされるためで す。&lt;br /&gt;
&lt;br /&gt;
「マスター」ホストの良い選択は、FSMOの「PDCエミュレータ」を含む一台です。なぜなら、他のDCのいずれかを選択するのではなく、このコン ピュータのみに接続するようににグループポリシー管理コンソールを構成できるからです（既定）。GPMCが接続するコンピュータの「アクション」／「ドメインコントローラの変更」で定義できます。そこでは「PDCエミュレータ用の操作マスタートークンをもつドメインコントローラ」（ デフォルト）を選択する必要があります。&lt;br /&gt;
&lt;br /&gt;
rsyncの単一方向のレプリケーションは制限がありますが、多くの利点もあります。&lt;br /&gt;
&lt;br /&gt;
* ほとんどのディストリビューションで既に利用可能であり、パッケージマネージャを使用してインストールすることもできます（まだインストールされていない場合）&lt;br /&gt;
* 非常に迅速にセットアップできます&lt;br /&gt;
* 非常に簡単に設定できます&lt;br /&gt;
* 等々&lt;br /&gt;
&lt;br /&gt;
rsyncをSSHトンネル経由で使用する場合は、必要に応じてコマンドを適用できますが、通常はSysVol共有に機密コンテンツはありません。ほとんどの場合、暗号化されていない転送を使用するだけで十分です。 PDCエミュレータ上のrsyncモジュールもソースとしてのみ使用されるため、読み取り専用と して定義されているため、コンテンツをプッシュすることはできません。&lt;br /&gt;
&lt;br /&gt;
== Sysvolレプリケーションを設定する ==&lt;br /&gt;
&lt;br /&gt;
=== PCDエミュレータFSMOロールをもつドメインコントローラでの設定 ===&lt;br /&gt;
&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* もし、xinetdを通してrsyncサーバを開始するのであれば、以下の設定ファイルを使用できます（&amp;lt;code&amp;gt;/etc/xinetd.d/rsync&amp;lt;/code&amp;gt;）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;service rsync&lt;br /&gt;
{&lt;br /&gt;
   disable         = no&lt;br /&gt;
   only_from       = 10.99.0.0/28     # Restrict to your DC address(es) or ranges, to prevent other hosts retrieving the content, too.&lt;br /&gt;
   socket_type     = stream&lt;br /&gt;
   wait            = no&lt;br /&gt;
   user            = root&lt;br /&gt;
   server          = /usr/bin/rsync&lt;br /&gt;
   server_args     = --daemon&lt;br /&gt;
   log_on_failure += USERID&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;/etc/rsyncd.conf&amp;lt;/code&amp;gt;を作成（path変数はPDCエミュレータのSysvolのパスに適合させてください）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[SysVol]&lt;br /&gt;
path = /usr/local/samba/var/locks/sysvol/&lt;br /&gt;
comment = Samba Sysvol Share&lt;br /&gt;
uid = root&lt;br /&gt;
gid = root&lt;br /&gt;
read only = yes&lt;br /&gt;
auth users = sysvol-replication&lt;br /&gt;
secrets file = /usr/local/samba/etc/rsyncd.secret&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 以下の内容（パスワードはそちらに合わせて改変してください）で&amp;lt;code&amp;gt;/usr/local/samba/etc/rsyncd.secret&amp;lt;/code&amp;gt;ファイルを作成してく ださい（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysvol-replication:pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;xinetd&amp;lt;/code&amp;gt;を再スタートしてください。&lt;br /&gt;
&lt;br /&gt;
=== その他のドメインコントローラの設定 ===&lt;br /&gt;
&lt;br /&gt;
* [[ Samba_DCを既存のActive_Directoryに参加させる#ビルトインユーザーとグループIDのマッピング|全てのDCでビルトイングループが同一のIDを持っていること]]を確認してください。&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* パスワードファイル&amp;lt;code&amp;gt;/usr/local/samba/etc/rsync-sysvol.secret&amp;lt;/code&amp;gt;を作成し、あなたがsysvolレプリケーションのrsyncアカウント用のPDCでセットしたパスワードで埋めて下さい。（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Sysvolフォルダーを複製するために、以下のコマンドを実行して下さい（&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;は実際に変更が加えられないことを意味します）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rsync --dry-run -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&lt;br /&gt;
&lt;br /&gt;
receiving file list ... done                                                                                                      &lt;br /&gt;
created directory /usr/local/samba/var/locks/sysvol                                                                               &lt;br /&gt;
./                                                                                                                                &lt;br /&gt;
samdom.example.com/                                                                                                               &lt;br /&gt;
samdom.example.com/Policies/                                                                                                      &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/                                                               &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/GPT.INI                                                        &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/                                                       &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Registry.pol                                           &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/                                                          &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Documents &amp;amp;amp; Settings/                                 &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/                                                  &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logoff/&lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logon/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/GPT.INI&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/MACHINE/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/USER/&lt;br /&gt;
samdom.example.com/scripts/&lt;br /&gt;
samdom.example.com/scripts/logonscript.bat&lt;br /&gt;
&lt;br /&gt;
sent 124 bytes  received 1064 bytes  2376.00 bytes/sec&lt;br /&gt;
total size is 1207  speedup is 1.02 (DRY RUN)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;警告：宛先のフォルダが本当にSysvolフォルダーであるか確認してください。コマンドは指定されたディレクトリに複製し、なおかつソース にないものは全て削除されます。システムにダメージを与える可能性があります。ですので、レプリケーションが期待通りに動作しているか確認するために、出力を注意深くチェックして下さい。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* すべて正常に動作しているのであれば、&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;オプションなしでコマンドを実行し、&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;にレプリケーション実行させます。&lt;br /&gt;
* 自動的に同期できるように、コマンドを&amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt;で実行してください（例えば、5分毎に）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;*/5 * * * *          rsync -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&amp;lt;/pre&amp;gt;&lt;br /&gt;
* これらのステップを全てのDCで繰り返して下さい（PDCは除く）。&lt;br /&gt;
&lt;br /&gt;
== FAQ ==&lt;br /&gt;
&lt;br /&gt;
* どのようにすれば、複数方向のレプリケーションを実行できますか？&lt;br /&gt;
:* これを実現するために、unisonとrsyncを使用しているテストがいくつかあります。&lt;br /&gt;
:* ここを見て下さい：&lt;br /&gt;
:* https://wiki.samba.org/index.php/Bidirectional_Rsync/Unison_based_SysVol_replication_workaround&lt;br /&gt;
* なぜ、SysvolのためにGlusterFS、Lustreなどの分散型ファイルシステムをシンプルに使えないのですか？&lt;br /&gt;
:* Sambaを使用するクラスタファイルシステムでは、CTDBを安全に実行する必要があります。それに、CTDBとAD DCは互換性がありません。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_DC%E3%82%92%E6%97%A2%E5%AD%98%E3%81%AEActive_Directory%E3%81%AB%E5%8F%82%E5%8A%A0%E3%81%95%E3%81%9B%E3%82%8B&amp;diff=10046</id>
		<title>Samba DCを既存のActive Directoryに参加させる</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_DC%E3%82%92%E6%97%A2%E5%AD%98%E3%81%AEActive_Directory%E3%81%AB%E5%8F%82%E5%8A%A0%E3%81%95%E3%81%9B%E3%82%8B&amp;diff=10046"/>
		<updated>2019-03-12T14:10:45Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* 組み込みのユーザーIDとグループIDのマッピング */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
Active Directory（AD）フォレストでは、1つのドメインコントローラ（DC）を実行するだけで十分です。 ただし、フェールオーバーとロードバランシングの理由から、ADフォレストにさらにDCを追加する必要があります。 既存のADに追加のSamba DCを参加させることは、フォレスト内の最初のDCをプロビジョニングすることとは異なります。 新しいADフォレストを設定する場合は、「[[SambaをActive Directoryドメインコントローラとして設定する‎‎]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text =  NT4ドメインは、1つのプライマリドメインコントローラ（PDC）とオプションで追加のバックアップドメインコントローラ（BDC）のみを使用します。 FSMOの役割を除いては、ADフォレストでは、ドメインコントローラ間に違いはありません。 混乱の可能性を避けるためにADについて話すときは、用語「ドメインコントローラ」または「DC」のみを使用してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= インストールの準備 =&lt;br /&gt;
&lt;br /&gt;
詳細については、[[SambaをActive Directoryドメインコントローラとして設定する‎‎]]の[[SambaをActive Directoryドメインコントローラとして設定する‎‎#インストールの準備|インストールの準備]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
= Sambaのインストール =&lt;br /&gt;
&lt;br /&gt;
詳細については、[[Sambaのインストール]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = notice&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text = メンテナンスされたSambaのバージョンをインストールしてください。 詳細は、「[[Sambaリリース計画]]」を参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= ドメインに参加するためのホストの準備 =&lt;br /&gt;
&lt;br /&gt;
== ローカルDNSサーバー ==&lt;br /&gt;
&lt;br /&gt;
既定では、フォレスト内の最初のドメインコントローラ（DC）は、Active Directory（AD）ベースのゾーン用のDNSサーバーを実行します。フェイルオーバーの理由から、ネットワーク内のDNSサーバーとして機能する複数のDCを実行することをお勧めします。新しいDCでDNSサービスを提供することを検討する場合：&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;BIND9_DLZ&amp;lt;/code&amp;gt; DNSバックエンドについては、「[[BIND9 DLZ DNSバックエンド]]」を参照してください。 Samba DCサービスを開始する前に、この作業を完了してください。&lt;br /&gt;
* 内部DNSについては、これ以上の操作は必要ありません。&lt;br /&gt;
&lt;br /&gt;
== DNSの設定 ==&lt;br /&gt;
&lt;br /&gt;
詳細については、[[LinuxとUnixのDNS設定]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = notice&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text = `/etc/resolv.conf`に設定した`nameserver`は、AD DCである必要があります。そうしないと、既存のADへの参加するときにKDCを見つけることができません。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Kerberos ==&lt;br /&gt;
&lt;br /&gt;
Kerberosクライアント構成ファイル&amp;lt;code&amp;gt;/etc/krb5.conf&amp;lt;/code&amp;gt;に次の設定を行います。&lt;br /&gt;
&lt;br /&gt;
 [libdefaults]&lt;br /&gt;
     dns_lookup_realm = false&lt;br /&gt;
     dns_lookup_kdc = true&lt;br /&gt;
     default_realm = SAMDOM.EXAMPLE.COM&lt;br /&gt;
&lt;br /&gt;
設定を確認するには、&amp;lt;code&amp;gt;kinit&amp;lt;/code&amp;gt;コマンドを使用してドメイン管理者のKerberosチケットを要求します。&lt;br /&gt;
&lt;br /&gt;
 # kinit administrator&lt;br /&gt;
 Password for administrator@SAMDOM.EXAMPLE.COM:&lt;br /&gt;
&lt;br /&gt;
Kerberosチケットを一覧表示するには：&lt;br /&gt;
&lt;br /&gt;
 # klist&lt;br /&gt;
 Ticket cache: FILE:/tmp/krb5cc_0&lt;br /&gt;
 Default principal: administrator@SAMDOM.EXAMPLE.COM&lt;br /&gt;
 &lt;br /&gt;
 Valid starting       Expires              Service principal&lt;br /&gt;
 24.09.2015 19:56:55  25.09.2015 05:56:55  krbtgt/SAMDOM.EXAMPLE.COM@SAMDOM.EXAMPLE.COM&lt;br /&gt;
         renew until 25.09.2015 19:56:53&lt;br /&gt;
&lt;br /&gt;
= ドメインコントローラとしてActive Directoryに参加 =&lt;br /&gt;
&lt;br /&gt;
Samba内部DNSを使って、追加のDNSサーバーとして働くドメインコントローラ(DC)を、ドメイン&amp;lt;code&amp;gt;samdom.example.com&amp;lt;/code&amp;gt;に参加させるには：&lt;br /&gt;
&lt;br /&gt;
 # samba-tool domain join samdom.example.com DC -U&amp;quot;SAMDOM\administrator&amp;quot; --dns-backend=SAMBA_INTERNAL&lt;br /&gt;
 Finding a writeable DC for domain &#039;samdom.example.com&#039;&lt;br /&gt;
 Found DC dc1.samdom.example.com&lt;br /&gt;
 Password for [SAMDOM\administrator]:&lt;br /&gt;
 workgroup is SAMDOM&lt;br /&gt;
 realm is samdom.example.com&lt;br /&gt;
 Adding CN=DC2,OU=Domain Controllers,DC=samdom,DC=example,DC=com&lt;br /&gt;
 Adding CN=DC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samdom,DC=example,DC=com&lt;br /&gt;
 Adding CN=NTDS Settings,CN=DC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samdom,DC=example,DC=com&lt;br /&gt;
 Adding SPNs to CN=DC2,OU=Domain Controllers,DC=samdom,DC=example,DC=com&lt;br /&gt;
 Setting account password for DC2$&lt;br /&gt;
 Enabling account&lt;br /&gt;
 Calling bare provision&lt;br /&gt;
 Looking up IPv4 addresses&lt;br /&gt;
 Looking up IPv6 addresses&lt;br /&gt;
 No IPv6 address will be assigned&lt;br /&gt;
 Setting up share.ldb&lt;br /&gt;
 Setting up secrets.ldb&lt;br /&gt;
 Setting up the registry&lt;br /&gt;
 Setting up the privileges database&lt;br /&gt;
 Setting up idmap db&lt;br /&gt;
 Setting up SAM db&lt;br /&gt;
 Setting up sam.ldb partitions and settings&lt;br /&gt;
 Setting up sam.ldb rootDSE&lt;br /&gt;
 Pre-loading the Samba 4 and AD schema&lt;br /&gt;
 A Kerberos configuration suitable for Samba 4 has been generated at /usr/local/samba/private/krb5.conf&lt;br /&gt;
 Provision OK for domain DN DC=samdom,DC=example,DC=com&lt;br /&gt;
 Starting replication&lt;br /&gt;
 Schema-DN[CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=com] objects[402/1550] linked_values[0/0]&lt;br /&gt;
 Schema-DN[CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=com] objects[804/1550] linked_values[0/0]&lt;br /&gt;
 Schema-DN[CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=com] objects[1206/1550] linked_values[0/0]&lt;br /&gt;
 Schema-DN[CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=com] objects[1550/1550] linked_values[0/0]&lt;br /&gt;
 Analyze and apply schema objects&lt;br /&gt;
 Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[402/1618] linked_values[0/0]&lt;br /&gt;
 Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[804/1618] linked_values[0/0]&lt;br /&gt;
 Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[1206/1618] linked_values[0/0]&lt;br /&gt;
 Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[1608/1618] linked_values[0/0]&lt;br /&gt;
 Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[1618/1618] linked_values[42/0]&lt;br /&gt;
 Replicating critical objects from the base DN of the domain&lt;br /&gt;
 Partition[DC=samdom,DC=example,DC=com] objects[100/100] linked_values[23/0]&lt;br /&gt;
 Partition[DC=samdom,DC=example,DC=com] objects[386/286] linked_values[23/0]&lt;br /&gt;
 Done with always replicated NC (base, config, schema)&lt;br /&gt;
 Replicating DC=DomainDnsZones,DC=samdom,DC=example,DC=com&lt;br /&gt;
 Partition[DC=DomainDnsZones,DC=samdom,DC=example,DC=com] objects[44/44] linked_values[0/0]&lt;br /&gt;
 Replicating DC=ForestDnsZones,DC=samdom,DC=example,DC=com&lt;br /&gt;
 Partition[DC=ForestDnsZones,DC=samdom,DC=example,DC=com] objects[19/19] linked_values[0/0]&lt;br /&gt;
 Committing SAM database&lt;br /&gt;
 Sending DsReplicaUpdateRefs for all the replicated partitions&lt;br /&gt;
 Setting isSynchronized and dsServiceName&lt;br /&gt;
 Setting up secrets database&lt;br /&gt;
 Joined domain SAMDOM (SID S-1-5-21-469703510-2364959079-1506205053) as a DC&lt;br /&gt;
&lt;br /&gt;
詳細については、&amp;lt;code&amp;gt;samba-tool domain join --help&amp;lt;/code&amp;gt;コマンドの出力を参照してください。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;samba-tool domain join&amp;lt;/code&amp;gt;コマンドで頻繁に使用されるその他のパラメータ：&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;--site=SITE&amp;lt;/code&amp;gt;：DCとして特定の[[Active Directoryサイト]]にホストに直接参加します。&lt;br /&gt;
* &amp;lt;code&amp;gt;--option=&amp;quot;interfaces=lo eth0&amp;quot; --option=&amp;quot;bind interfaces only=yes&amp;quot;&amp;lt;/code&amp;gt;：サーバに複数のネットワークインタフェースがある場合は、これらのオプションを使用して指定されたインタフェースにSambaをバインドします。これにより、&amp;lt;code&amp;gt;samba-tool&amp;lt;/code&amp;gt;コマンドは参加中に正しいLAN IPアドレスをディレクトリに登録できます。&lt;br /&gt;
&lt;br /&gt;
{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text =  他のDCがSamba DCで、&amp;lt;code&amp;gt;--use-rfc2307&amp;lt;/code&amp;gt;でプロビジョニングされている場合は、joinコマンドに&amp;lt;code&amp;gt;--option=&#039;idmap_ldb:use rfc2307 = yes&#039;&amp;lt;/code&amp;gt;を追加する必要があります。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= DNSエントリの確認 =&lt;br /&gt;
&lt;br /&gt;
Samba 4.7以降を実行しているSamba DCに参加すると、必要なすべてのDNSエントリが自動的に作成されます。以前のバージョンで手動でレコードを作成するには、[[DC DNSレコードの確認と作成]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
= BIND9_DLZ DNSバックエンドの設定 =&lt;br /&gt;
&lt;br /&gt;
ドメイン参加中に&amp;lt;code&amp;gt;BIND9_DLZ DNS&amp;lt;/code&amp;gt;バックエンドを選択した場合は、BIND構成を設定します。詳細については、「[[BIND9_DLZ DNSバックエンド]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ビルトインユーザーとグループIDのマッピング =&lt;br /&gt;
&lt;br /&gt;
Sysvolの複製は、Sambaでは今のところサポートされていません。 [[Sysvolレプリケーション(DFS-R)|Sysvolレプリケーション]]の回避策を使用するには、すべてのドメインコントローラ（DC）が、ビルトインユーザーおよびグループに対して同じIDマッピングを使用する必要があります。&lt;br /&gt;
&lt;br /&gt;
デフォルトでは、Samba DCはユーザーIDとグループIDを &#039;idmap.ldb&#039;の &#039;xidNumber&#039;属性に格納します。 &#039;idmap.ldb&#039;の仕組みにより、各DCが特定のユーザーまたはグループに対して同じIDを使用することを保証することはできません。同じIDを使用するには、次のことを行う必要があります。&lt;br /&gt;
&lt;br /&gt;
* 既存のDC上の&amp;lt;code&amp;gt;/usr/local/samba/private/idmap.ldb&amp;lt;/code&amp;gt;ファイルのホットバックアップを作成します。&lt;br /&gt;
&lt;br /&gt;
 # tdbbackup -s .bak /usr/local/samba/private/idmap.ldb&lt;br /&gt;
&lt;br /&gt;
: これにより、バックアップファイル&amp;lt;code&amp;gt;/usr/local/samba/private/idmap.ldb.bak&amp;lt;/code&amp;gt;が作成されます。&lt;br /&gt;
&lt;br /&gt;
* バックアップファイルを新しい結合DC上の&amp;lt;code&amp;gt;/usr/local/samba/private/&amp;lt;/code&amp;gt;フォルダに移動し、&amp;lt;code&amp;gt;.bak&amp;lt;/code&amp;gt;拡張子を削除して既存のファイルを置き換えます。&lt;br /&gt;
* 新しいDC上のSysvolフォルダのファイルシステムアクセス制御リスト（ACL）をリセットします。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # samba-tool ntacl sysvolreset&lt;br /&gt;
&lt;br /&gt;
= Sambaサービスの開始 =&lt;br /&gt;
&lt;br /&gt;
Samba Active Directory（AD）ドメインコントローラ（DC）サービスを手動で起動するには、次のように入力します。&lt;br /&gt;
&lt;br /&gt;
 # samba&lt;br /&gt;
&lt;br /&gt;
SambaはSystem Vのinitスクリプト、&amp;lt;code&amp;gt;systemd&amp;lt;/code&amp;gt;、&amp;lt;code&amp;gt;upstart&amp;lt;/code&amp;gt;、またはその他のサービス設定ファイルを提供していません。&lt;br /&gt;
&lt;br /&gt;
* パッケージを使用してSambaをインストールした場合は、パッケージに含まれているスクリプトまたはサービス設定ファイルを使用してSambaを起動します。&lt;br /&gt;
* Sambaをビルドした場合は、「[[Samba AD DCサービスの管理]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ディレクトリレプリケーションの確認 =&lt;br /&gt;
&lt;br /&gt;
ドメインコントローラー（DC）が起動されると、Samba DCの知識整合性チェッカー（KCC）によってActive Directory（AD）フォレスト内の他のDCへのレプリケーションアグリーメントが作成されます。 KCCが自動生成レプリケーション接続を作成するまでに最大15分かかることがあります。&lt;br /&gt;
&lt;br /&gt;
ディレクトリ複製が正しく機能することを確認する方法の詳細については、「[[ディレクトリレプリケーションの状態を確認]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text  = レプリケーションの待ち時間とコストを最適化するために、Samba 4.5以降のKCCでは、すべてのDC間で完全メッシュレプリケーショントポロジが作成されなくなりました。詳細については、「[[Samba KCC]]」を参照してください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= BINDの起動 =&lt;br /&gt;
&lt;br /&gt;
BINDデーモンを開始する前に、DNSディレクトリパーティションが正常に複製されていることを確認します。&lt;br /&gt;
&lt;br /&gt;
 # samba-tool drs showrepl&lt;br /&gt;
 ...&lt;br /&gt;
 ==== INBOUND NEIGHBORS ====&lt;br /&gt;
 ...&lt;br /&gt;
 DC=DomainDnsZones,DC=samdom,DC=example,DC=com&lt;br /&gt;
         Default-First-Site-Name\DC1 via RPC&lt;br /&gt;
         DSA object GUID: 4a6bd92a-6612-4b15-aa8c-9ec371e8994f&lt;br /&gt;
         Last attempt @ Thu Sep 24 20:08:45 2015 CEST was successful&lt;br /&gt;
         0 consecutive failure(s).&lt;br /&gt;
         Last success @ Thu Sep 24 20:08:45 2015 CEST&lt;br /&gt;
 ...&lt;br /&gt;
 DC=ForestDnsZones,DC=samdom,DC=example,DC=com&lt;br /&gt;
         Default-First-Site-Name\DC1 via RPC&lt;br /&gt;
         DSA object GUID: 4a6bd92a-6612-4b15-aa8c-9ec371e8994f&lt;br /&gt;
         Last attempt @ Thu Sep 24 20:08:45 2015 CEST was successful&lt;br /&gt;
         0 consecutive failure(s).&lt;br /&gt;
         Last success @ Thu Sep 24 20:08:45 2015 CEST&lt;br /&gt;
&lt;br /&gt;
レプリケーションが正常に動作する場合は、BINDサービスを開始します。サービスを開始する方法については、ディストリビューションのドキュメントを参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Samba AD DCのテスト =&lt;br /&gt;
&lt;br /&gt;
== ファイルサーバーの確認 ==&lt;br /&gt;
&lt;br /&gt;
詳細については、「[[SambaをActive Directoryドメインコントローラとして設定する]]」の[[SambaをActive Directoryドメインコントローラとして設定する#ファイルサーバーの確認|ファイルサーバーの確認]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
== ローカルDNSサーバーのテスト ==&lt;br /&gt;
&lt;br /&gt;
結合中に&amp;lt;code&amp;gt;--dns-backend=NONE&amp;lt;/code&amp;gt;を選択した場合は、この手順をスキップしてください。&lt;br /&gt;
&lt;br /&gt;
ローカルDNSサーバーを照会して、ドメイン名&amp;lt;code&amp;gt;samdom.example.com&amp;lt;/code&amp;gt;を解決します。&lt;br /&gt;
&lt;br /&gt;
 # host -t A samdom.example.com localhost&lt;br /&gt;
 Using domain server:&lt;br /&gt;
 Name: localhost&lt;br /&gt;
 Address: 127.0.0.1#53&lt;br /&gt;
 Aliases:&lt;br /&gt;
 &lt;br /&gt;
 samdom.example.com has address 10.99.0.1&lt;br /&gt;
 samdom.example.com has address 10.99.0.2&lt;br /&gt;
```&lt;br /&gt;
&lt;br /&gt;
ローカルDNSは、ドメイン名をすべてのドメインコントローラ（DC）のIPアドレスに解決します。&lt;br /&gt;
&lt;br /&gt;
結果が表示されない場合や、別の結果が表示された場合は、このドキュメントを確認して次を確認してください。&lt;br /&gt;
&lt;br /&gt;
* システムログファイル、&lt;br /&gt;
* Sambaのログファイル、&lt;br /&gt;
* &amp;lt;code&amp;gt;BIND9_DLZ&amp;lt;/code&amp;gt;が使用されている場合は、BINDログ・ファイル。&lt;br /&gt;
&lt;br /&gt;
== Kerberosの確認 ==&lt;br /&gt;
&lt;br /&gt;
詳細については、[[SambaをActive Directoryドメインコントローラとして設定する]]の[[SambaをActive Directoryドメインコントローラとして設定する#Kerberosの確認|Kerberosの確認]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
= ドメインコントローラでのDNSの構成 =&lt;br /&gt;
&lt;br /&gt;
他のDCを見つけることができない場合、複製が失敗するため、ドメインコントローラ（DC）のDNS構成は重要です。ドメインコントローラ（DC）でのDNS構成のベストプラクティスは次のとおりです。&lt;br /&gt;
&lt;br /&gt;
DCのローカルIPを&amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;ファイルの二次的または三次的ネームサーバーのエントリとして設定し、フォレストのプライマリネームサーバーとは異なるActive Directory（AD）DNSサーバーIPを使用します。例えば：&lt;br /&gt;
&lt;br /&gt;
新たに参加したDCでは、既存のDCの&amp;lt;code&amp;gt;10.99.0.1&amp;lt;/code&amp;gt;のIPをプライマリとして使用し、ローカルの&amp;lt;code&amp;gt;10.99.0.2&amp;lt;/code&amp;gt;のIPをセカンダリネームサーバーのエントリとして使用します。&lt;br /&gt;
&lt;br /&gt;
 nameserver 10.99.0.1&lt;br /&gt;
 nameserver 10.99.0.2       # IP of the new joined DC as secondary entry&lt;br /&gt;
 search samdom.example.com&lt;br /&gt;
&lt;br /&gt;
2つ以上のDCを実行している場合は、IPを横方向に設定できます。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= 時刻同期の設定 =&lt;br /&gt;
&lt;br /&gt;
Kerberosでは、すべてのドメインメンバーに同期時間が必要です。詳細とntpdサービスの設定方法については、[[時刻の同期]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
= Samba AD DCでのWinbinddの設定 =&lt;br /&gt;
&lt;br /&gt;
オプション。詳細については、[[Samba AD DC上でのWinbinddの設定]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
= ドメインコントローラをファイルサーバーとして使用する =&lt;br /&gt;
&lt;br /&gt;
詳細については、「[[SambaをActive Directoryドメインコントローラとして設定する#ドメインコントローラをファイルサーバーとして使用する]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sysvolレプリケーション =&lt;br /&gt;
&lt;br /&gt;
Sambaは現在、Sysvolの複製をサポートしていません。サポートされていない回避策については、[[Sysvolレプリケーション(DFS-R)|Sysvolレプリケーション]]を参照してください。&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = notice&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text  = 他のDC上のSysvolに既定のGPO以外にもGPOがある場合は、Sysvolを新しいDCに同期する必要があります。&amp;lt;code&amp;gt;samba-tool ntacl sysvolreset&amp;lt;/code&amp;gt;はエラーをスローします。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= ディレクトリレプリケーションのテスト =&lt;br /&gt;
&lt;br /&gt;
ディレクトリ複製が正常に動作することをテストするには、たとえば既存のDC上にユーザーを追加し、新しく追加されたDC上に自動的に表示されることを確認します。&lt;br /&gt;
&lt;br /&gt;
オプションで、&amp;lt;code&amp;gt;ldapcmp&amp;lt;/code&amp;gt;ユーティリティを使用して2つのディレクトリを比較します。詳細は、「[[samba-tool ldapcmp]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= トラブルシューティング =&lt;br /&gt;
&lt;br /&gt;
詳細は、「[[Samba AD DCトラブルシューティング]]」を参照してください。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10045</id>
		<title>RsyncベースのSysvolレプリケーションの回避策</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10045"/>
		<updated>2019-03-12T14:04:55Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* PCDエミュレータFSMOロールをもつドメインコントローラでの設定 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
Samba ADは現在、SysVolレプリケーションのサポートを提供していません。 Multi-DC環境でこの重要な機能を実現するには、実装するまで、同 期を維持するための回避策が必要です。このHowToは、rsyncに基づいた基本的な回避策のソリューションを提供します。&lt;br /&gt;
&lt;br /&gt;
== rsyncベースのレプリケーションに関する情報 ==&lt;br /&gt;
&lt;br /&gt;
[[Image:DC_PDC_emulator.png|thumb|PDCのためのグループポリシー管理コンソールのオプション]]&lt;br /&gt;
&lt;br /&gt;
このHowToでは、rsyncに基づいたSysVolレプリケーションのソリューションについて説明します。このツールは一方向です。つまり、ファイルは一方向にしか転送できません。そのため、rsyncベースのSysVolレプリケーションでは、すべての変更（GPO編集、ログオンスクリプトの変更など）を行うDCを1つ選択する必要があります。他のすべてのDCはこのホストからの変更を取得します。これは、同期時に変更が上書きされるためで す。&lt;br /&gt;
&lt;br /&gt;
「マスター」ホストの良い選択は、FSMOの「PDCエミュレータ」を含む一台です。なぜなら、他のDCのいずれかを選択するのではなく、このコン ピュータのみに接続するようににグループポリシー管理コンソールを構成できるからです（既定）。GPMCが接続するコンピュータの「アクション」／「ドメインコントローラの変更」で定義できます。そこでは「PDCエミュレータ用の操作マスタートークンをもつドメインコントローラ」（ デフォルト）を選択する必要があります。&lt;br /&gt;
&lt;br /&gt;
rsyncの単一方向のレプリケーションは制限がありますが、多くの利点もあります。&lt;br /&gt;
&lt;br /&gt;
* ほとんどのディストリビューションで既に利用可能であり、パッケージマネージャを使用してインストールすることもできます（まだインストールされていない場合）&lt;br /&gt;
* 非常に迅速にセットアップできます&lt;br /&gt;
* 非常に簡単に設定できます&lt;br /&gt;
* 等々&lt;br /&gt;
&lt;br /&gt;
rsyncをSSHトンネル経由で使用する場合は、必要に応じてコマンドを適用できますが、通常はSysVol共有に機密コンテンツはありません。ほとんどの場合、暗号化されていない転送を使用するだけで十分です。 PDCエミュレータ上のrsyncモジュールもソースとしてのみ使用されるため、読み取り専用と して定義されているため、コンテンツをプッシュすることはできません。&lt;br /&gt;
&lt;br /&gt;
== Sysvolレプリケーションを設定する ==&lt;br /&gt;
&lt;br /&gt;
=== PCDエミュレータFSMOロールをもつドメインコントローラでの設定 ===&lt;br /&gt;
&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* もし、xinetdを通してrsyncサーバを開始するのであれば、以下の設定ファイルを使用できます（&amp;lt;code&amp;gt;/etc/xinetd.d/rsync&amp;lt;/code&amp;gt;）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;service rsync&lt;br /&gt;
{&lt;br /&gt;
   disable         = no&lt;br /&gt;
   only_from       = 10.99.0.0/28     # Restrict to your DC address(es) or ranges, to prevent other hosts retrieving the content, too.&lt;br /&gt;
   socket_type     = stream&lt;br /&gt;
   wait            = no&lt;br /&gt;
   user            = root&lt;br /&gt;
   server          = /usr/bin/rsync&lt;br /&gt;
   server_args     = --daemon&lt;br /&gt;
   log_on_failure += USERID&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;/etc/rsyncd.conf&amp;lt;/code&amp;gt;を作成（path変数はPDCエミュレータのSysvolのパスに適合させてください）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[SysVol]&lt;br /&gt;
path = /usr/local/samba/var/locks/sysvol/&lt;br /&gt;
comment = Samba Sysvol Share&lt;br /&gt;
uid = root&lt;br /&gt;
gid = root&lt;br /&gt;
read only = yes&lt;br /&gt;
auth users = sysvol-replication&lt;br /&gt;
secrets file = /usr/local/samba/etc/rsyncd.secret&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 以下の内容（パスワードはそちらに合わせて改変してください）で&amp;lt;code&amp;gt;/usr/local/samba/etc/rsyncd.secret&amp;lt;/code&amp;gt;ファイルを作成してく ださい（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysvol-replication:pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;xinetd&amp;lt;/code&amp;gt;を再スタートしてください。&lt;br /&gt;
&lt;br /&gt;
=== その他のドメインコントローラの設定 ===&lt;br /&gt;
&lt;br /&gt;
* 全てのDCでビルトイングループが同一のIDを持っていることを確認してください。&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* パスワードファイル&amp;lt;code&amp;gt;/usr/local/samba/etc/rsync-sysvol.secret&amp;lt;/code&amp;gt;を作成し、あなたがsysvolレプリケーションのrsyncアカウント用のPDCでセットしたパスワードで埋めて下さい。（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Sysvolフォルダーを複製するために、以下のコマンドを実行して下さい（&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;は実際に変更が加えられないことを意味します）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rsync --dry-run -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&lt;br /&gt;
&lt;br /&gt;
receiving file list ... done                                                                                                      &lt;br /&gt;
created directory /usr/local/samba/var/locks/sysvol                                                                               &lt;br /&gt;
./                                                                                                                                &lt;br /&gt;
samdom.example.com/                                                                                                               &lt;br /&gt;
samdom.example.com/Policies/                                                                                                      &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/                                                               &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/GPT.INI                                                        &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/                                                       &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Registry.pol                                           &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/                                                          &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Documents &amp;amp;amp; Settings/                                 &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/                                                  &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logoff/&lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logon/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/GPT.INI&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/MACHINE/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/USER/&lt;br /&gt;
samdom.example.com/scripts/&lt;br /&gt;
samdom.example.com/scripts/logonscript.bat&lt;br /&gt;
&lt;br /&gt;
sent 124 bytes  received 1064 bytes  2376.00 bytes/sec&lt;br /&gt;
total size is 1207  speedup is 1.02 (DRY RUN)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;警告：宛先のフォルダが本当にSysvolフォルダーであるか確認してください。コマンドは指定されたディレクトリに複製し、なおかつソース にないものは全て削除されます。システムにダメージを与える可能性があります。ですので、レプリケーションが期待通りに動作しているか確認するために、出力を注意深くチェックして下さい。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* すべて正常に動作しているのであれば、&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;オプションなしでコマンドを実行し、&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;にレプリケーション実行させます。&lt;br /&gt;
* 自動的に同期できるように、コマンドを&amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt;で実行してください（例えば、5分毎に）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;*/5 * * * *          rsync -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&amp;lt;/pre&amp;gt;&lt;br /&gt;
* これらのステップを全てのDCで繰り返して下さい（PDCは除く）。&lt;br /&gt;
&lt;br /&gt;
== FAQ ==&lt;br /&gt;
&lt;br /&gt;
* どのようにすれば、複数方向のレプリケーションを実行できますか？&lt;br /&gt;
:* これを実現するために、unisonとrsyncを使用しているテストがいくつかあります。&lt;br /&gt;
:* ここを見て下さい：&lt;br /&gt;
:* https://wiki.samba.org/index.php/Bidirectional_Rsync/Unison_based_SysVol_replication_workaround&lt;br /&gt;
* なぜ、SysvolのためにGlusterFS、Lustreなどの分散型ファイルシステムをシンプルに使えないのですか？&lt;br /&gt;
:* Sambaを使用するクラスタファイルシステムでは、CTDBを安全に実行する必要があります。それに、CTDBとAD DCは互換性がありません。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10044</id>
		<title>RsyncベースのSysvolレプリケーションの回避策</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Rsync%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AESysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E5%9B%9E%E9%81%BF%E7%AD%96&amp;diff=10044"/>
		<updated>2019-03-12T14:04:02Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* rsyncベースのレプリケーションに関する情報 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== はじめに ==&lt;br /&gt;
&lt;br /&gt;
Samba ADは現在、SysVolレプリケーションのサポートを提供していません。 Multi-DC環境でこの重要な機能を実現するには、実装するまで、同 期を維持するための回避策が必要です。このHowToは、rsyncに基づいた基本的な回避策のソリューションを提供します。&lt;br /&gt;
&lt;br /&gt;
== rsyncベースのレプリケーションに関する情報 ==&lt;br /&gt;
&lt;br /&gt;
[[Image:DC_PDC_emulator.png|thumb|PDCのためのグループポリシー管理コンソールのオプション]]&lt;br /&gt;
&lt;br /&gt;
このHowToでは、rsyncに基づいたSysVolレプリケーションのソリューションについて説明します。このツールは一方向です。つまり、ファイルは一方向にしか転送できません。そのため、rsyncベースのSysVolレプリケーションでは、すべての変更（GPO編集、ログオンスクリプトの変更など）を行うDCを1つ選択する必要があります。他のすべてのDCはこのホストからの変更を取得します。これは、同期時に変更が上書きされるためで す。&lt;br /&gt;
&lt;br /&gt;
「マスター」ホストの良い選択は、FSMOの「PDCエミュレータ」を含む一台です。なぜなら、他のDCのいずれかを選択するのではなく、このコン ピュータのみに接続するようににグループポリシー管理コンソールを構成できるからです（既定）。GPMCが接続するコンピュータの「アクション」／「ドメインコントローラの変更」で定義できます。そこでは「PDCエミュレータ用の操作マスタートークンをもつドメインコントローラ」（ デフォルト）を選択する必要があります。&lt;br /&gt;
&lt;br /&gt;
rsyncの単一方向のレプリケーションは制限がありますが、多くの利点もあります。&lt;br /&gt;
&lt;br /&gt;
* ほとんどのディストリビューションで既に利用可能であり、パッケージマネージャを使用してインストールすることもできます（まだインストールされていない場合）&lt;br /&gt;
* 非常に迅速にセットアップできます&lt;br /&gt;
* 非常に簡単に設定できます&lt;br /&gt;
* 等々&lt;br /&gt;
&lt;br /&gt;
rsyncをSSHトンネル経由で使用する場合は、必要に応じてコマンドを適用できますが、通常はSysVol共有に機密コンテンツはありません。ほとんどの場合、暗号化されていない転送を使用するだけで十分です。 PDCエミュレータ上のrsyncモジュールもソースとしてのみ使用されるため、読み取り専用と して定義されているため、コンテンツをプッシュすることはできません。&lt;br /&gt;
&lt;br /&gt;
== Sysvolレプリケーションを設定する ==&lt;br /&gt;
&lt;br /&gt;
=== PCDエミュレータFSMOロールをもつドメインコントローラでの設定 ===&lt;br /&gt;
&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* もし、xinetdを通してrsyncサーバを開始するのであれば、以下の設定ファイルを使用できます（&amp;lt;code&amp;gt;/etc/xinetd.d/rsync&amp;lt;/code&amp;gt;）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;service rsync&lt;br /&gt;
{&lt;br /&gt;
   disable         = no&lt;br /&gt;
   only_from       = 10.99.0.0/28     # Restrict to your DC address(es) or ranges, to prevent other hosts retrieving the content, too.&lt;br /&gt;
   socket_type     = stream&lt;br /&gt;
   wait            = no&lt;br /&gt;
   user            = root&lt;br /&gt;
   server          = /usr/bin/rsync&lt;br /&gt;
   server_args     = --daemon&lt;br /&gt;
   log_on_failure += USERID&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;/etc/rsyncd.conf&amp;lt;/code&amp;gt;を作成（path変数はPDCのSysvolのパスに適合させてください）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[SysVol]&lt;br /&gt;
path = /usr/local/samba/var/locks/sysvol/&lt;br /&gt;
comment = Samba Sysvol Share&lt;br /&gt;
uid = root&lt;br /&gt;
gid = root&lt;br /&gt;
read only = yes&lt;br /&gt;
auth users = sysvol-replication&lt;br /&gt;
secrets file = /usr/local/samba/etc/rsyncd.secret&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 以下の内容（パスワードはそちらに合わせて改変してください）で&amp;lt;code&amp;gt;/usr/local/samba/etc/rsyncd.secret&amp;lt;/code&amp;gt;ファイルを作成してく ださい（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysvol-replication:pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;xinetd&amp;lt;/code&amp;gt;を再スタートしてください。&lt;br /&gt;
&lt;br /&gt;
=== その他のドメインコントローラの設定 ===&lt;br /&gt;
&lt;br /&gt;
* 全てのDCでビルトイングループが同一のIDを持っていることを確認してください。&lt;br /&gt;
* パッケージマネージャを用いるか、あるいはソースからコンパイルして&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;をインストールします。使用しているバージョンが、拡張ACLをサポートしているかどうか確認してください。&lt;br /&gt;
* パスワードファイル&amp;lt;code&amp;gt;/usr/local/samba/etc/rsync-sysvol.secret&amp;lt;/code&amp;gt;を作成し、あなたがsysvolレプリケーションのrsyncアカウント用のPDCでセットしたパスワードで埋めて下さい。（ファイルのパーミッションは誰でも読み取れるようにしてはいけません）：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;pa$$w0rd&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Sysvolフォルダーを複製するために、以下のコマンドを実行して下さい（&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;は実際に変更が加えられないことを意味します）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# rsync --dry-run -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&lt;br /&gt;
&lt;br /&gt;
receiving file list ... done                                                                                                      &lt;br /&gt;
created directory /usr/local/samba/var/locks/sysvol                                                                               &lt;br /&gt;
./                                                                                                                                &lt;br /&gt;
samdom.example.com/                                                                                                               &lt;br /&gt;
samdom.example.com/Policies/                                                                                                      &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/                                                               &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/GPT.INI                                                        &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/                                                       &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/MACHINE/Registry.pol                                           &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/                                                          &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Documents &amp;amp;amp; Settings/                                 &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/                                                  &lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logoff/&lt;br /&gt;
samdom.example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/USER/Scripts/Logon/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/GPT.INI&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/MACHINE/&lt;br /&gt;
samdom.example.com/Policies/{6AC1786C-016F-11D2-945F-00C04FB984F9}/USER/&lt;br /&gt;
samdom.example.com/scripts/&lt;br /&gt;
samdom.example.com/scripts/logonscript.bat&lt;br /&gt;
&lt;br /&gt;
sent 124 bytes  received 1064 bytes  2376.00 bytes/sec&lt;br /&gt;
total size is 1207  speedup is 1.02 (DRY RUN)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;警告：宛先のフォルダが本当にSysvolフォルダーであるか確認してください。コマンドは指定されたディレクトリに複製し、なおかつソース にないものは全て削除されます。システムにダメージを与える可能性があります。ですので、レプリケーションが期待通りに動作しているか確認するために、出力を注意深くチェックして下さい。&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* すべて正常に動作しているのであれば、&amp;lt;code&amp;gt;--dry-run&amp;lt;/code&amp;gt;オプションなしでコマンドを実行し、&amp;lt;code&amp;gt;rsync&amp;lt;/code&amp;gt;にレプリケーション実行させます。&lt;br /&gt;
* 自動的に同期できるように、コマンドを&amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt;で実行してください（例えば、5分毎に）。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;*/5 * * * *          rsync -XAavz --delete-after --password-file=/usr/local/samba/etc/rsync-sysvol.secret rsync://sysvol-replication@{IP-of-you-PDC}/SysVol/ /path/to/your/sysvol/folder/&amp;lt;/pre&amp;gt;&lt;br /&gt;
* これらのステップを全てのDCで繰り返して下さい（PDCは除く）。&lt;br /&gt;
&lt;br /&gt;
== FAQ ==&lt;br /&gt;
&lt;br /&gt;
* どのようにすれば、複数方向のレプリケーションを実行できますか？&lt;br /&gt;
:* これを実現するために、unisonとrsyncを使用しているテストがいくつかあります。&lt;br /&gt;
:* ここを見て下さい：&lt;br /&gt;
:* https://wiki.samba.org/index.php/Bidirectional_Rsync/Unison_based_SysVol_replication_workaround&lt;br /&gt;
* なぜ、SysvolのためにGlusterFS、Lustreなどの分散型ファイルシステムをシンプルに使えないのですか？&lt;br /&gt;
:* Sambaを使用するクラスタファイルシステムでは、CTDBを安全に実行する必要があります。それに、CTDBとAD DCは互換性がありません。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Sysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%EF%BC%88DFS-R%EF%BC%89&amp;diff=10043</id>
		<title>Sysvolレプリケーション（DFS-R）</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Sysvol%E3%83%AC%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%EF%BC%88DFS-R%EF%BC%89&amp;diff=10043"/>
		<updated>2019-03-12T13:59:25Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;現在の状態のSambaは、SysvolレプリケーションのためにWindows Server 2000/2003で使用されているDFS-R（Distributed File System Replication：分散ファイルシステムレプリケーション）または古いFRS（File Replication Service：ファイルレプリケーションサービス）によるSysVolレプリケーションをサポートしていません。&lt;br /&gt;
&lt;br /&gt;
現時点では、管理者に対しては次のいずれかの回避策を使用するようアドバイスしています。&lt;br /&gt;
&lt;br /&gt;
* [[RsyncベースのSysvolレプリケーションの回避策]] (Samba DC 同士のみ)： 早く構成でき、設定が容易。&lt;br /&gt;
* [[双方向のRsync/UnisonベースのSysvolレプリケーション回避策]] (Samba DC 同士のみ)： より複雑で、サードパーティー製のスクリ&lt;br /&gt;
プトが必要。どのDCもお互いのDCに対してCronジョブが必要&lt;br /&gt;
* [[双方向のRsync/osyncベースのSysvolレプリケーション回避策(]](Samba DC 同士のみ)： より複雑で、サードパーティー製のスクリプトが必要。どのDCもお互いのDCに対してCronジョブが必要&lt;br /&gt;
* [[RobocopyベースのSysvolレプリケーション回避策]](Samba DC&amp;amp;rarr;Windows DC間)： すばやく構成でき、設定も容易。MS robocopyを使用。&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10042</id>
		<title>分散ファイルシステム(DFS)</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10042"/>
		<updated>2019-03-11T15:24:53Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Limitations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FRS vs DFS vs DFS-R ==&lt;br /&gt;
&lt;br /&gt;
FRS (ファイルレプリケーションサービス)はWindows Server 2000と2003でSYSVOLを複製するために使用されています。新しいバージョンのWindowsサーバーでは、Microsoftによって少しずつDFS-R(Distributed File System Replication = 分散ファイルシステムレプリケーション)に置き換えられています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;まだ、SambaにはFRSにも、DFS-Rにも、SYSVOLレプリケーションは含まれていません。&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DFS-Rはしばしば、DFS(下記参照)のサブ機能とみなされており、両方共一緒に使用されますが、完全に別々に使用することもできます:&lt;br /&gt;
複数のターゲットを持つDFSは、DFS-Rなしで使用することが可能(フォルダーの内容が別の方法で更新された場合でも)で、DFS-RはDFSターゲットでない共有フォルダを複製できます。&lt;br /&gt;
&lt;br /&gt;
Sambaは、DFSを部分的にサポートしますが、DFS-Rはまだサポートしていません。&lt;br /&gt;
&lt;br /&gt;
== DFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DFSとは何か ===&lt;br /&gt;
&lt;br /&gt;
DFS (Distributed File System = 分散ファイルシステム) は、いくつかの機能を提供する機能です:&lt;br /&gt;
例えば、代替の名前空間、ロードバランシング、自動フェイルオーバーなど。&lt;br /&gt;
&lt;br /&gt;
技術的には、DFSはファイルを含まない、ジャンクションのみの、必要に応じて多くのジャンクションを持つサブディレクトリの共有ディレクトリへのアクセスを提供します。&lt;br /&gt;
ジャンクションとは、Unixファイルシステムで知られているような、ソフトリンクに似ていますが、共有ディレクトリを指すものであり、また、他のサーバー上の共有ディレクトリを指すこともできます。クライアントはまず最初にジャンクションをDFSサーバーに問い合わせ、それからこのジャンクションが指し示すファイルサーバーにアクセスします。&lt;br /&gt;
&lt;br /&gt;
これの主な用途は、基になるインフラストラクチャの詳細をユーザーから隠す代替の名前空間（ディレクトリツリービュー）を作成することです。ユーザーに表示されるパス（DFS名と呼ばれる）は、サーバーの名前が変更されたとき、または一部のディレクトリが別のサーバーに移動されたときにも変わりません。管理者は、古いDFS名を新しいターゲットに単純に置き換えることができます。&lt;br /&gt;
&lt;br /&gt;
DFS名は、オプションで複数のターゲットを指すことができます（つまり、クライアントにいくつかの代替ジャンクションを異なる共有フォルダーに伝える）。この場合、クライアントはどちらのターゲットにもアクセスできます。これにより、1つのサーバーに障害が発生した場合に、負荷分散と他のサーバーへの自動フェイルオーバーが可能になります。&lt;br /&gt;
&lt;br /&gt;
=== スタンドアローン vs ドメインベースのDFS ===&lt;br /&gt;
DFSは、スタンドアロンでもドメインベースでもかまいません。&lt;br /&gt;
&lt;br /&gt;
スタンドアロン版は1つのサーバー上で実行され、DFS名にそのサーバーの名前が含まれるようにします。それらはそのサーバーによって提供される共有のように見えます。&lt;br /&gt;
&lt;br /&gt;
ドメインベースのセットアップでは、DFS名にドメイン名のみが含まれ、特定のサーバーの名前は含まれません。ドメイン内のいくつかのサーバーは、並行してDFSサーバーとして機能できます。クライアントは自動的にいずれかのDFSサーバーを選択し、そのサーバーにクエリを送信します。&lt;br /&gt;
&lt;br /&gt;
=== SambaでスタンドアロンDFSを設定する ===&lt;br /&gt;
&lt;br /&gt;
Sambaでスタンドアロンのバリアントを設定する方法はここに記述されています:&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/msdfs.html&lt;br /&gt;
&lt;br /&gt;
要するに、設定ファイル smb.conf の globalオプションが必要です。&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
(AD-DCではデフォルトです)&lt;br /&gt;
そして、2つのオプションを共有の定義に追加します。&lt;br /&gt;
  path = /export/dfsroot&lt;br /&gt;
  msdfs root = yes&lt;br /&gt;
それから、指定したバスで、次のようなコマンドを実行し、エントリを作成します&lt;br /&gt;
  ln -s msdfs:storage0\\share0 linka&lt;br /&gt;
  ln -s msdfs:server1\\share,server2\\share linkb&lt;br /&gt;
&lt;br /&gt;
最初の例は、一つのターゲットを定義しており、2番めの例は、同じ内容を共有する2つの代替ターゲットを作成しています。&lt;br /&gt;
&lt;br /&gt;
Windowsクライアントは、これらをジャンクションとみなします。&lt;br /&gt;
&lt;br /&gt;
=== SambaでメンバーサーバーDFSを構成する ===&lt;br /&gt;
&lt;br /&gt;
上記と似ていますが、smb.confのglobalオプションにもう一つ追加のオプションが必要です。&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
  vfs object = dfs_samba4&lt;br /&gt;
&lt;br /&gt;
他はちょうど上で何が起こるかに従ってください。&lt;br /&gt;
&lt;br /&gt;
=== SambaでドメインベースのDFSを構成する ===&lt;br /&gt;
&lt;br /&gt;
手順は、スタンドアローンのDFSとおなじですが、vfs_object dfs_samba4が必要で(AD-DC ではデフォルトですが、&amp;lt;code&amp;gt;vfs object&amp;lt;/code&amp;gt;オプションの落とし穴には注意してください)、DFS名は各DCで定義されている必要があります。&lt;br /&gt;
([https://lists.samba.org/archive/samba/2014-June/182705.html DFSのエンドポイントマッパーが実装されていないため]).&lt;br /&gt;
&lt;br /&gt;
現在(2014年7月現在)、メーリングリストで議論されており、複数のユーザーはSamba4でのドメインベースDFS使用が大変困難であることを報告しており、それはおそらくsmbプロトコル バージョン3の実装に関連していると思われます。&lt;br /&gt;
&lt;br /&gt;
=== 制限事項 ===&lt;br /&gt;
&lt;br /&gt;
DFS共有で指定されているパスdfsroot、またはlnコマンド内の共有パスのいずれも大文字を含んではいけません。リンクは大文字を含むことが許されるかもしれません。&lt;br /&gt;
&lt;br /&gt;
Samba 4.1.4ではDFSはAdministratorに対してのみ 機能し、すべてのユーザーに対して機能するためのパッチが必要です。&lt;br /&gt;
&lt;br /&gt;
ドメインベースのDFSが本当に機能するかどうか、現在メーリングリストで議論が続いています。&lt;br /&gt;
&lt;br /&gt;
DFS-R（レプリケーション）はまだ実装されていません。&lt;br /&gt;
&lt;br /&gt;
Neither the path dfsroot specified in the DFS share, nor any&lt;br /&gt;
of the share paths in the ln-commands must contain upper case characters.&lt;br /&gt;
The links might be allowed to contain upper case characters.&lt;br /&gt;
&lt;br /&gt;
DFS works only for Administrator in Samba 4.1.4, and &lt;br /&gt;
[https://groups.google.com/forum/?_escaped_fragment_=topic/linux.samba/mi4O5lHE8Vc#!topic/linux.samba/mi4O5lHE8Vc requires a patch] to work for all users.&lt;br /&gt;
&lt;br /&gt;
There is currently an ongoing discussion in the mailing list whether or not domain-based DFS really works.&lt;br /&gt;
&lt;br /&gt;
DFS-R (replication) is not yet implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10041</id>
		<title>分散ファイルシステム(DFS)</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10041"/>
		<updated>2019-03-11T15:23:57Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Configure domain-based DFS in Samba */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FRS vs DFS vs DFS-R ==&lt;br /&gt;
&lt;br /&gt;
FRS (ファイルレプリケーションサービス)はWindows Server 2000と2003でSYSVOLを複製するために使用されています。新しいバージョンのWindowsサーバーでは、Microsoftによって少しずつDFS-R(Distributed File System Replication = 分散ファイルシステムレプリケーション)に置き換えられています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;まだ、SambaにはFRSにも、DFS-Rにも、SYSVOLレプリケーションは含まれていません。&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DFS-Rはしばしば、DFS(下記参照)のサブ機能とみなされており、両方共一緒に使用されますが、完全に別々に使用することもできます:&lt;br /&gt;
複数のターゲットを持つDFSは、DFS-Rなしで使用することが可能(フォルダーの内容が別の方法で更新された場合でも)で、DFS-RはDFSターゲットでない共有フォルダを複製できます。&lt;br /&gt;
&lt;br /&gt;
Sambaは、DFSを部分的にサポートしますが、DFS-Rはまだサポートしていません。&lt;br /&gt;
&lt;br /&gt;
== DFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DFSとは何か ===&lt;br /&gt;
&lt;br /&gt;
DFS (Distributed File System = 分散ファイルシステム) は、いくつかの機能を提供する機能です:&lt;br /&gt;
例えば、代替の名前空間、ロードバランシング、自動フェイルオーバーなど。&lt;br /&gt;
&lt;br /&gt;
技術的には、DFSはファイルを含まない、ジャンクションのみの、必要に応じて多くのジャンクションを持つサブディレクトリの共有ディレクトリへのアクセスを提供します。&lt;br /&gt;
ジャンクションとは、Unixファイルシステムで知られているような、ソフトリンクに似ていますが、共有ディレクトリを指すものであり、また、他のサーバー上の共有ディレクトリを指すこともできます。クライアントはまず最初にジャンクションをDFSサーバーに問い合わせ、それからこのジャンクションが指し示すファイルサーバーにアクセスします。&lt;br /&gt;
&lt;br /&gt;
これの主な用途は、基になるインフラストラクチャの詳細をユーザーから隠す代替の名前空間（ディレクトリツリービュー）を作成することです。ユーザーに表示されるパス（DFS名と呼ばれる）は、サーバーの名前が変更されたとき、または一部のディレクトリが別のサーバーに移動されたときにも変わりません。管理者は、古いDFS名を新しいターゲットに単純に置き換えることができます。&lt;br /&gt;
&lt;br /&gt;
DFS名は、オプションで複数のターゲットを指すことができます（つまり、クライアントにいくつかの代替ジャンクションを異なる共有フォルダーに伝える）。この場合、クライアントはどちらのターゲットにもアクセスできます。これにより、1つのサーバーに障害が発生した場合に、負荷分散と他のサーバーへの自動フェイルオーバーが可能になります。&lt;br /&gt;
&lt;br /&gt;
=== スタンドアローン vs ドメインベースのDFS ===&lt;br /&gt;
DFSは、スタンドアロンでもドメインベースでもかまいません。&lt;br /&gt;
&lt;br /&gt;
スタンドアロン版は1つのサーバー上で実行され、DFS名にそのサーバーの名前が含まれるようにします。それらはそのサーバーによって提供される共有のように見えます。&lt;br /&gt;
&lt;br /&gt;
ドメインベースのセットアップでは、DFS名にドメイン名のみが含まれ、特定のサーバーの名前は含まれません。ドメイン内のいくつかのサーバーは、並行してDFSサーバーとして機能できます。クライアントは自動的にいずれかのDFSサーバーを選択し、そのサーバーにクエリを送信します。&lt;br /&gt;
&lt;br /&gt;
=== SambaでスタンドアロンDFSを設定する ===&lt;br /&gt;
&lt;br /&gt;
Sambaでスタンドアロンのバリアントを設定する方法はここに記述されています:&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/msdfs.html&lt;br /&gt;
&lt;br /&gt;
要するに、設定ファイル smb.conf の globalオプションが必要です。&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
(AD-DCではデフォルトです)&lt;br /&gt;
そして、2つのオプションを共有の定義に追加します。&lt;br /&gt;
  path = /export/dfsroot&lt;br /&gt;
  msdfs root = yes&lt;br /&gt;
それから、指定したバスで、次のようなコマンドを実行し、エントリを作成します&lt;br /&gt;
  ln -s msdfs:storage0\\share0 linka&lt;br /&gt;
  ln -s msdfs:server1\\share,server2\\share linkb&lt;br /&gt;
&lt;br /&gt;
最初の例は、一つのターゲットを定義しており、2番めの例は、同じ内容を共有する2つの代替ターゲットを作成しています。&lt;br /&gt;
&lt;br /&gt;
Windowsクライアントは、これらをジャンクションとみなします。&lt;br /&gt;
&lt;br /&gt;
=== SambaでメンバーサーバーDFSを構成する ===&lt;br /&gt;
&lt;br /&gt;
上記と似ていますが、smb.confのglobalオプションにもう一つ追加のオプションが必要です。&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
  vfs object = dfs_samba4&lt;br /&gt;
&lt;br /&gt;
他はちょうど上で何が起こるかに従ってください。&lt;br /&gt;
&lt;br /&gt;
=== SambaでドメインベースのDFSを構成する ===&lt;br /&gt;
&lt;br /&gt;
手順は、スタンドアローンのDFSとおなじですが、vfs_object dfs_samba4が必要で(AD-DC ではデフォルトですが、&amp;lt;code&amp;gt;vfs object&amp;lt;/code&amp;gt;オプションの落とし穴には注意してください)、DFS名は各DCで定義されている必要があります。&lt;br /&gt;
([https://lists.samba.org/archive/samba/2014-June/182705.html DFSのエンドポイントマッパーが実装されていないため]).&lt;br /&gt;
&lt;br /&gt;
現在(2014年7月現在)、メーリングリストで議論されており、複数のユーザーはSamba4でのドメインベースDFS使用が大変困難であることを報告しており、それはおそらくsmbプロトコル バージョン3の実装に関連していると思われます。&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
Neither the path dfsroot specified in the DFS share, nor any&lt;br /&gt;
of the share paths in the ln-commands must contain upper case characters.&lt;br /&gt;
The links might be allowed to contain upper case characters.&lt;br /&gt;
&lt;br /&gt;
DFS works only for Administrator in Samba 4.1.4, and &lt;br /&gt;
[https://groups.google.com/forum/?_escaped_fragment_=topic/linux.samba/mi4O5lHE8Vc#!topic/linux.samba/mi4O5lHE8Vc requires a patch] to work for all users.&lt;br /&gt;
&lt;br /&gt;
There is currently an ongoing discussion in the mailing list whether or not domain-based DFS really works.&lt;br /&gt;
&lt;br /&gt;
DFS-R (replication) is not yet implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10040</id>
		<title>分散ファイルシステム(DFS)</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10040"/>
		<updated>2019-03-11T15:11:58Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Configure Member server DFS in Samba */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FRS vs DFS vs DFS-R ==&lt;br /&gt;
&lt;br /&gt;
FRS (ファイルレプリケーションサービス)はWindows Server 2000と2003でSYSVOLを複製するために使用されています。新しいバージョンのWindowsサーバーでは、Microsoftによって少しずつDFS-R(Distributed File System Replication = 分散ファイルシステムレプリケーション)に置き換えられています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;まだ、SambaにはFRSにも、DFS-Rにも、SYSVOLレプリケーションは含まれていません。&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DFS-Rはしばしば、DFS(下記参照)のサブ機能とみなされており、両方共一緒に使用されますが、完全に別々に使用することもできます:&lt;br /&gt;
複数のターゲットを持つDFSは、DFS-Rなしで使用することが可能(フォルダーの内容が別の方法で更新された場合でも)で、DFS-RはDFSターゲットでない共有フォルダを複製できます。&lt;br /&gt;
&lt;br /&gt;
Sambaは、DFSを部分的にサポートしますが、DFS-Rはまだサポートしていません。&lt;br /&gt;
&lt;br /&gt;
== DFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DFSとは何か ===&lt;br /&gt;
&lt;br /&gt;
DFS (Distributed File System = 分散ファイルシステム) は、いくつかの機能を提供する機能です:&lt;br /&gt;
例えば、代替の名前空間、ロードバランシング、自動フェイルオーバーなど。&lt;br /&gt;
&lt;br /&gt;
技術的には、DFSはファイルを含まない、ジャンクションのみの、必要に応じて多くのジャンクションを持つサブディレクトリの共有ディレクトリへのアクセスを提供します。&lt;br /&gt;
ジャンクションとは、Unixファイルシステムで知られているような、ソフトリンクに似ていますが、共有ディレクトリを指すものであり、また、他のサーバー上の共有ディレクトリを指すこともできます。クライアントはまず最初にジャンクションをDFSサーバーに問い合わせ、それからこのジャンクションが指し示すファイルサーバーにアクセスします。&lt;br /&gt;
&lt;br /&gt;
これの主な用途は、基になるインフラストラクチャの詳細をユーザーから隠す代替の名前空間（ディレクトリツリービュー）を作成することです。ユーザーに表示されるパス（DFS名と呼ばれる）は、サーバーの名前が変更されたとき、または一部のディレクトリが別のサーバーに移動されたときにも変わりません。管理者は、古いDFS名を新しいターゲットに単純に置き換えることができます。&lt;br /&gt;
&lt;br /&gt;
DFS名は、オプションで複数のターゲットを指すことができます（つまり、クライアントにいくつかの代替ジャンクションを異なる共有フォルダーに伝える）。この場合、クライアントはどちらのターゲットにもアクセスできます。これにより、1つのサーバーに障害が発生した場合に、負荷分散と他のサーバーへの自動フェイルオーバーが可能になります。&lt;br /&gt;
&lt;br /&gt;
=== スタンドアローン vs ドメインベースのDFS ===&lt;br /&gt;
DFSは、スタンドアロンでもドメインベースでもかまいません。&lt;br /&gt;
&lt;br /&gt;
スタンドアロン版は1つのサーバー上で実行され、DFS名にそのサーバーの名前が含まれるようにします。それらはそのサーバーによって提供される共有のように見えます。&lt;br /&gt;
&lt;br /&gt;
ドメインベースのセットアップでは、DFS名にドメイン名のみが含まれ、特定のサーバーの名前は含まれません。ドメイン内のいくつかのサーバーは、並行してDFSサーバーとして機能できます。クライアントは自動的にいずれかのDFSサーバーを選択し、そのサーバーにクエリを送信します。&lt;br /&gt;
&lt;br /&gt;
=== SambaでスタンドアロンDFSを設定する ===&lt;br /&gt;
&lt;br /&gt;
Sambaでスタンドアロンのバリアントを設定する方法はここに記述されています:&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/msdfs.html&lt;br /&gt;
&lt;br /&gt;
要するに、設定ファイル smb.conf の globalオプションが必要です。&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
(AD-DCではデフォルトです)&lt;br /&gt;
そして、2つのオプションを共有の定義に追加します。&lt;br /&gt;
  path = /export/dfsroot&lt;br /&gt;
  msdfs root = yes&lt;br /&gt;
それから、指定したバスで、次のようなコマンドを実行し、エントリを作成します&lt;br /&gt;
  ln -s msdfs:storage0\\share0 linka&lt;br /&gt;
  ln -s msdfs:server1\\share,server2\\share linkb&lt;br /&gt;
&lt;br /&gt;
最初の例は、一つのターゲットを定義しており、2番めの例は、同じ内容を共有する2つの代替ターゲットを作成しています。&lt;br /&gt;
&lt;br /&gt;
Windowsクライアントは、これらをジャンクションとみなします。&lt;br /&gt;
&lt;br /&gt;
=== SambaでメンバーサーバーDFSを構成する ===&lt;br /&gt;
&lt;br /&gt;
上記と似ていますが、smb.confのglobalオプションにもう一つ追加のオプションが必要です。&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
  vfs object = dfs_samba4&lt;br /&gt;
&lt;br /&gt;
他はちょうど上で何が起こるかに従ってください。&lt;br /&gt;
&lt;br /&gt;
=== Configure domain-based DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The procedure is the same as for stand-alone DFS, but it requires the vfs_object dfs_samba4 (which is default in AD-DC, but beware of the pitfalls of the &amp;lt;code&amp;gt;vfs object&amp;lt;/code&amp;gt; option),&lt;br /&gt;
and the DFS names must be declared on each DC&lt;br /&gt;
([https://lists.samba.org/archive/samba/2014-June/182705.html because the endpointmapper for DFS is not implemented]).&lt;br /&gt;
&lt;br /&gt;
There is currently (July 2014) a discussion in the mailing list in which several users report great difficulties with domain-based DFS in samba 4, maybe related with the implementation of smb protocol version 3.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
Neither the path dfsroot specified in the DFS share, nor any&lt;br /&gt;
of the share paths in the ln-commands must contain upper case characters.&lt;br /&gt;
The links might be allowed to contain upper case characters.&lt;br /&gt;
&lt;br /&gt;
DFS works only for Administrator in Samba 4.1.4, and &lt;br /&gt;
[https://groups.google.com/forum/?_escaped_fragment_=topic/linux.samba/mi4O5lHE8Vc#!topic/linux.samba/mi4O5lHE8Vc requires a patch] to work for all users.&lt;br /&gt;
&lt;br /&gt;
There is currently an ongoing discussion in the mailing list whether or not domain-based DFS really works.&lt;br /&gt;
&lt;br /&gt;
DFS-R (replication) is not yet implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10039</id>
		<title>分散ファイルシステム(DFS)</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10039"/>
		<updated>2019-03-11T15:06:06Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* Configure stand-alone DFS in Samba */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FRS vs DFS vs DFS-R ==&lt;br /&gt;
&lt;br /&gt;
FRS (ファイルレプリケーションサービス)はWindows Server 2000と2003でSYSVOLを複製するために使用されています。新しいバージョンのWindowsサーバーでは、Microsoftによって少しずつDFS-R(Distributed File System Replication = 分散ファイルシステムレプリケーション)に置き換えられています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;まだ、SambaにはFRSにも、DFS-Rにも、SYSVOLレプリケーションは含まれていません。&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DFS-Rはしばしば、DFS(下記参照)のサブ機能とみなされており、両方共一緒に使用されますが、完全に別々に使用することもできます:&lt;br /&gt;
複数のターゲットを持つDFSは、DFS-Rなしで使用することが可能(フォルダーの内容が別の方法で更新された場合でも)で、DFS-RはDFSターゲットでない共有フォルダを複製できます。&lt;br /&gt;
&lt;br /&gt;
Sambaは、DFSを部分的にサポートしますが、DFS-Rはまだサポートしていません。&lt;br /&gt;
&lt;br /&gt;
== DFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DFSとは何か ===&lt;br /&gt;
&lt;br /&gt;
DFS (Distributed File System = 分散ファイルシステム) は、いくつかの機能を提供する機能です:&lt;br /&gt;
例えば、代替の名前空間、ロードバランシング、自動フェイルオーバーなど。&lt;br /&gt;
&lt;br /&gt;
技術的には、DFSはファイルを含まない、ジャンクションのみの、必要に応じて多くのジャンクションを持つサブディレクトリの共有ディレクトリへのアクセスを提供します。&lt;br /&gt;
ジャンクションとは、Unixファイルシステムで知られているような、ソフトリンクに似ていますが、共有ディレクトリを指すものであり、また、他のサーバー上の共有ディレクトリを指すこともできます。クライアントはまず最初にジャンクションをDFSサーバーに問い合わせ、それからこのジャンクションが指し示すファイルサーバーにアクセスします。&lt;br /&gt;
&lt;br /&gt;
これの主な用途は、基になるインフラストラクチャの詳細をユーザーから隠す代替の名前空間（ディレクトリツリービュー）を作成することです。ユーザーに表示されるパス（DFS名と呼ばれる）は、サーバーの名前が変更されたとき、または一部のディレクトリが別のサーバーに移動されたときにも変わりません。管理者は、古いDFS名を新しいターゲットに単純に置き換えることができます。&lt;br /&gt;
&lt;br /&gt;
DFS名は、オプションで複数のターゲットを指すことができます（つまり、クライアントにいくつかの代替ジャンクションを異なる共有フォルダーに伝える）。この場合、クライアントはどちらのターゲットにもアクセスできます。これにより、1つのサーバーに障害が発生した場合に、負荷分散と他のサーバーへの自動フェイルオーバーが可能になります。&lt;br /&gt;
&lt;br /&gt;
=== スタンドアローン vs ドメインベースのDFS ===&lt;br /&gt;
DFSは、スタンドアロンでもドメインベースでもかまいません。&lt;br /&gt;
&lt;br /&gt;
スタンドアロン版は1つのサーバー上で実行され、DFS名にそのサーバーの名前が含まれるようにします。それらはそのサーバーによって提供される共有のように見えます。&lt;br /&gt;
&lt;br /&gt;
ドメインベースのセットアップでは、DFS名にドメイン名のみが含まれ、特定のサーバーの名前は含まれません。ドメイン内のいくつかのサーバーは、並行してDFSサーバーとして機能できます。クライアントは自動的にいずれかのDFSサーバーを選択し、そのサーバーにクエリを送信します。&lt;br /&gt;
&lt;br /&gt;
=== SambaでスタンドアロンDFSを設定する ===&lt;br /&gt;
&lt;br /&gt;
Sambaでスタンドアロンのバリアントを設定する方法はここに記述されています:&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/msdfs.html&lt;br /&gt;
&lt;br /&gt;
要するに、設定ファイル smb.conf の globalオプションが必要です。&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
(AD-DCではデフォルトです)&lt;br /&gt;
そして、2つのオプションを共有の定義に追加します。&lt;br /&gt;
  path = /export/dfsroot&lt;br /&gt;
  msdfs root = yes&lt;br /&gt;
それから、指定したバスで、次のようなコマンドを実行し、エントリを作成します&lt;br /&gt;
  ln -s msdfs:storage0\\share0 linka&lt;br /&gt;
  ln -s msdfs:server1\\share,server2\\share linkb&lt;br /&gt;
&lt;br /&gt;
最初の例は、一つのターゲットを定義しており、2番めの例は、同じ内容を共有する2つの代替ターゲットを作成しています。&lt;br /&gt;
&lt;br /&gt;
Windowsクライアントは、これらをジャンクションとみなします。&lt;br /&gt;
&lt;br /&gt;
=== Configure Member server DFS in Samba ===&lt;br /&gt;
  &lt;br /&gt;
Similar to above but required one additional setting in smb.conf the global option so it would be&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
  vfs object = dfs_samba4&lt;br /&gt;
&lt;br /&gt;
Other just follow what happen on above.&lt;br /&gt;
&lt;br /&gt;
=== Configure domain-based DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The procedure is the same as for stand-alone DFS, but it requires the vfs_object dfs_samba4 (which is default in AD-DC, but beware of the pitfalls of the &amp;lt;code&amp;gt;vfs object&amp;lt;/code&amp;gt; option),&lt;br /&gt;
and the DFS names must be declared on each DC&lt;br /&gt;
([https://lists.samba.org/archive/samba/2014-June/182705.html because the endpointmapper for DFS is not implemented]).&lt;br /&gt;
&lt;br /&gt;
There is currently (July 2014) a discussion in the mailing list in which several users report great difficulties with domain-based DFS in samba 4, maybe related with the implementation of smb protocol version 3.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
Neither the path dfsroot specified in the DFS share, nor any&lt;br /&gt;
of the share paths in the ln-commands must contain upper case characters.&lt;br /&gt;
The links might be allowed to contain upper case characters.&lt;br /&gt;
&lt;br /&gt;
DFS works only for Administrator in Samba 4.1.4, and &lt;br /&gt;
[https://groups.google.com/forum/?_escaped_fragment_=topic/linux.samba/mi4O5lHE8Vc#!topic/linux.samba/mi4O5lHE8Vc requires a patch] to work for all users.&lt;br /&gt;
&lt;br /&gt;
There is currently an ongoing discussion in the mailing list whether or not domain-based DFS really works.&lt;br /&gt;
&lt;br /&gt;
DFS-R (replication) is not yet implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10038</id>
		<title>分散ファイルシステム(DFS)</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10038"/>
		<updated>2019-03-11T14:48:58Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* stand-alone versus domain-based DFS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FRS vs DFS vs DFS-R ==&lt;br /&gt;
&lt;br /&gt;
FRS (ファイルレプリケーションサービス)はWindows Server 2000と2003でSYSVOLを複製するために使用されています。新しいバージョンのWindowsサーバーでは、Microsoftによって少しずつDFS-R(Distributed File System Replication = 分散ファイルシステムレプリケーション)に置き換えられています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;まだ、SambaにはFRSにも、DFS-Rにも、SYSVOLレプリケーションは含まれていません。&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DFS-Rはしばしば、DFS(下記参照)のサブ機能とみなされており、両方共一緒に使用されますが、完全に別々に使用することもできます:&lt;br /&gt;
複数のターゲットを持つDFSは、DFS-Rなしで使用することが可能(フォルダーの内容が別の方法で更新された場合でも)で、DFS-RはDFSターゲットでない共有フォルダを複製できます。&lt;br /&gt;
&lt;br /&gt;
Sambaは、DFSを部分的にサポートしますが、DFS-Rはまだサポートしていません。&lt;br /&gt;
&lt;br /&gt;
== DFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DFSとは何か ===&lt;br /&gt;
&lt;br /&gt;
DFS (Distributed File System = 分散ファイルシステム) は、いくつかの機能を提供する機能です:&lt;br /&gt;
例えば、代替の名前空間、ロードバランシング、自動フェイルオーバーなど。&lt;br /&gt;
&lt;br /&gt;
技術的には、DFSはファイルを含まない、ジャンクションのみの、必要に応じて多くのジャンクションを持つサブディレクトリの共有ディレクトリへのアクセスを提供します。&lt;br /&gt;
ジャンクションとは、Unixファイルシステムで知られているような、ソフトリンクに似ていますが、共有ディレクトリを指すものであり、また、他のサーバー上の共有ディレクトリを指すこともできます。クライアントはまず最初にジャンクションをDFSサーバーに問い合わせ、それからこのジャンクションが指し示すファイルサーバーにアクセスします。&lt;br /&gt;
&lt;br /&gt;
これの主な用途は、基になるインフラストラクチャの詳細をユーザーから隠す代替の名前空間（ディレクトリツリービュー）を作成することです。ユーザーに表示されるパス（DFS名と呼ばれる）は、サーバーの名前が変更されたとき、または一部のディレクトリが別のサーバーに移動されたときにも変わりません。管理者は、古いDFS名を新しいターゲットに単純に置き換えることができます。&lt;br /&gt;
&lt;br /&gt;
DFS名は、オプションで複数のターゲットを指すことができます（つまり、クライアントにいくつかの代替ジャンクションを異なる共有フォルダーに伝える）。この場合、クライアントはどちらのターゲットにもアクセスできます。これにより、1つのサーバーに障害が発生した場合に、負荷分散と他のサーバーへの自動フェイルオーバーが可能になります。&lt;br /&gt;
&lt;br /&gt;
=== スタンドアローン vs ドメインベースのDFS ===&lt;br /&gt;
DFSは、スタンドアロンでもドメインベースでもかまいません。&lt;br /&gt;
&lt;br /&gt;
スタンドアロン版は1つのサーバー上で実行され、DFS名にそのサーバーの名前が含まれるようにします。それらはそのサーバーによって提供される共有のように見えます。&lt;br /&gt;
&lt;br /&gt;
ドメインベースのセットアップでは、DFS名にドメイン名のみが含まれ、特定のサーバーの名前は含まれません。ドメイン内のいくつかのサーバーは、並行してDFSサーバーとして機能できます。クライアントは自動的にいずれかのDFSサーバーを選択し、そのサーバーにクエリを送信します。&lt;br /&gt;
&lt;br /&gt;
=== Configure stand-alone DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The method to set up the stand-alone variant with Samba is described here:&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/msdfs.html&lt;br /&gt;
&lt;br /&gt;
In short it requires in the config file smb.conf the global option &lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
(which is default on AD-DCs)&lt;br /&gt;
and in one share declaration the two options&lt;br /&gt;
  path = /export/dfsroot&lt;br /&gt;
  msdfs root = yes&lt;br /&gt;
Then in the specified path create entries by running commands like&lt;br /&gt;
  ln -s msdfs:storage0\\share0 linka&lt;br /&gt;
  ln -s msdfs:server1\\share,server2\\share linkb&lt;br /&gt;
&lt;br /&gt;
The first example defines one target, the second example creates two&lt;br /&gt;
alternative targets that share the same contents.&lt;br /&gt;
&lt;br /&gt;
Windows clients will see these as junctions.&lt;br /&gt;
&lt;br /&gt;
=== Configure Member server DFS in Samba ===&lt;br /&gt;
  &lt;br /&gt;
Similar to above but required one additional setting in smb.conf the global option so it would be&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
  vfs object = dfs_samba4&lt;br /&gt;
&lt;br /&gt;
Other just follow what happen on above.&lt;br /&gt;
&lt;br /&gt;
=== Configure domain-based DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The procedure is the same as for stand-alone DFS, but it requires the vfs_object dfs_samba4 (which is default in AD-DC, but beware of the pitfalls of the &amp;lt;code&amp;gt;vfs object&amp;lt;/code&amp;gt; option),&lt;br /&gt;
and the DFS names must be declared on each DC&lt;br /&gt;
([https://lists.samba.org/archive/samba/2014-June/182705.html because the endpointmapper for DFS is not implemented]).&lt;br /&gt;
&lt;br /&gt;
There is currently (July 2014) a discussion in the mailing list in which several users report great difficulties with domain-based DFS in samba 4, maybe related with the implementation of smb protocol version 3.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
Neither the path dfsroot specified in the DFS share, nor any&lt;br /&gt;
of the share paths in the ln-commands must contain upper case characters.&lt;br /&gt;
The links might be allowed to contain upper case characters.&lt;br /&gt;
&lt;br /&gt;
DFS works only for Administrator in Samba 4.1.4, and &lt;br /&gt;
[https://groups.google.com/forum/?_escaped_fragment_=topic/linux.samba/mi4O5lHE8Vc#!topic/linux.samba/mi4O5lHE8Vc requires a patch] to work for all users.&lt;br /&gt;
&lt;br /&gt;
There is currently an ongoing discussion in the mailing list whether or not domain-based DFS really works.&lt;br /&gt;
&lt;br /&gt;
DFS-R (replication) is not yet implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10037</id>
		<title>分散ファイルシステム(DFS)</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10037"/>
		<updated>2019-03-11T14:47:00Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* What is DFS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FRS vs DFS vs DFS-R ==&lt;br /&gt;
&lt;br /&gt;
FRS (ファイルレプリケーションサービス)はWindows Server 2000と2003でSYSVOLを複製するために使用されています。新しいバージョンのWindowsサーバーでは、Microsoftによって少しずつDFS-R(Distributed File System Replication = 分散ファイルシステムレプリケーション)に置き換えられています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;まだ、SambaにはFRSにも、DFS-Rにも、SYSVOLレプリケーションは含まれていません。&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DFS-Rはしばしば、DFS(下記参照)のサブ機能とみなされており、両方共一緒に使用されますが、完全に別々に使用することもできます:&lt;br /&gt;
複数のターゲットを持つDFSは、DFS-Rなしで使用することが可能(フォルダーの内容が別の方法で更新された場合でも)で、DFS-RはDFSターゲットでない共有フォルダを複製できます。&lt;br /&gt;
&lt;br /&gt;
Sambaは、DFSを部分的にサポートしますが、DFS-Rはまだサポートしていません。&lt;br /&gt;
&lt;br /&gt;
== DFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DFSとは何か ===&lt;br /&gt;
&lt;br /&gt;
DFS (Distributed File System = 分散ファイルシステム) は、いくつかの機能を提供する機能です:&lt;br /&gt;
例えば、代替の名前空間、ロードバランシング、自動フェイルオーバーなど。&lt;br /&gt;
&lt;br /&gt;
技術的には、DFSはファイルを含まない、ジャンクションのみの、必要に応じて多くのジャンクションを持つサブディレクトリの共有ディレクトリへのアクセスを提供します。&lt;br /&gt;
ジャンクションとは、Unixファイルシステムで知られているような、ソフトリンクに似ていますが、共有ディレクトリを指すものであり、また、他のサーバー上の共有ディレクトリを指すこともできます。クライアントはまず最初にジャンクションをDFSサーバーに問い合わせ、それからこのジャンクションが指し示すファイルサーバーにアクセスします。&lt;br /&gt;
&lt;br /&gt;
これの主な用途は、基になるインフラストラクチャの詳細をユーザーから隠す代替の名前空間（ディレクトリツリービュー）を作成することです。ユーザーに表示されるパス（DFS名と呼ばれる）は、サーバーの名前が変更されたとき、または一部のディレクトリが別のサーバーに移動されたときにも変わりません。管理者は、古いDFS名を新しいターゲットに単純に置き換えることができます。&lt;br /&gt;
&lt;br /&gt;
DFS名は、オプションで複数のターゲットを指すことができます（つまり、クライアントにいくつかの代替ジャンクションを異なる共有フォルダーに伝える）。この場合、クライアントはどちらのターゲットにもアクセスできます。これにより、1つのサーバーに障害が発生した場合に、負荷分散と他のサーバーへの自動フェイルオーバーが可能になります。&lt;br /&gt;
&lt;br /&gt;
=== stand-alone versus domain-based DFS ===&lt;br /&gt;
&lt;br /&gt;
DFS can be either stand-alone, or domain-based.&lt;br /&gt;
&lt;br /&gt;
The stand-alone variant runs on one single server and &lt;br /&gt;
causes the DFS names to contain the name of that server,&lt;br /&gt;
they look like shares that are provided by that server.&lt;br /&gt;
&lt;br /&gt;
The domain based setup causes the DFS names to contain only the&lt;br /&gt;
name of the domain, not the name of any specific server. Several&lt;br /&gt;
servers in the domain can act as DFS servers in parallel.&lt;br /&gt;
Clients automatically select one of the DFS servers and send &lt;br /&gt;
their queries to that one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configure stand-alone DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The method to set up the stand-alone variant with Samba is described here:&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/msdfs.html&lt;br /&gt;
&lt;br /&gt;
In short it requires in the config file smb.conf the global option &lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
(which is default on AD-DCs)&lt;br /&gt;
and in one share declaration the two options&lt;br /&gt;
  path = /export/dfsroot&lt;br /&gt;
  msdfs root = yes&lt;br /&gt;
Then in the specified path create entries by running commands like&lt;br /&gt;
  ln -s msdfs:storage0\\share0 linka&lt;br /&gt;
  ln -s msdfs:server1\\share,server2\\share linkb&lt;br /&gt;
&lt;br /&gt;
The first example defines one target, the second example creates two&lt;br /&gt;
alternative targets that share the same contents.&lt;br /&gt;
&lt;br /&gt;
Windows clients will see these as junctions.&lt;br /&gt;
&lt;br /&gt;
=== Configure Member server DFS in Samba ===&lt;br /&gt;
  &lt;br /&gt;
Similar to above but required one additional setting in smb.conf the global option so it would be&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
  vfs object = dfs_samba4&lt;br /&gt;
&lt;br /&gt;
Other just follow what happen on above.&lt;br /&gt;
&lt;br /&gt;
=== Configure domain-based DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The procedure is the same as for stand-alone DFS, but it requires the vfs_object dfs_samba4 (which is default in AD-DC, but beware of the pitfalls of the &amp;lt;code&amp;gt;vfs object&amp;lt;/code&amp;gt; option),&lt;br /&gt;
and the DFS names must be declared on each DC&lt;br /&gt;
([https://lists.samba.org/archive/samba/2014-June/182705.html because the endpointmapper for DFS is not implemented]).&lt;br /&gt;
&lt;br /&gt;
There is currently (July 2014) a discussion in the mailing list in which several users report great difficulties with domain-based DFS in samba 4, maybe related with the implementation of smb protocol version 3.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
Neither the path dfsroot specified in the DFS share, nor any&lt;br /&gt;
of the share paths in the ln-commands must contain upper case characters.&lt;br /&gt;
The links might be allowed to contain upper case characters.&lt;br /&gt;
&lt;br /&gt;
DFS works only for Administrator in Samba 4.1.4, and &lt;br /&gt;
[https://groups.google.com/forum/?_escaped_fragment_=topic/linux.samba/mi4O5lHE8Vc#!topic/linux.samba/mi4O5lHE8Vc requires a patch] to work for all users.&lt;br /&gt;
&lt;br /&gt;
There is currently an ongoing discussion in the mailing list whether or not domain-based DFS really works.&lt;br /&gt;
&lt;br /&gt;
DFS-R (replication) is not yet implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10036</id>
		<title>分散ファイルシステム(DFS)</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10036"/>
		<updated>2019-03-11T14:22:06Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: /* FRS versus DFS versus DFS-R */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FRS vs DFS vs DFS-R ==&lt;br /&gt;
&lt;br /&gt;
FRS (ファイルレプリケーションサービス)はWindows Server 2000と2003でSYSVOLを複製するために使用されています。新しいバージョンのWindowsサーバーでは、Microsoftによって少しずつDFS-R(Distributed File System Replication = 分散ファイルシステムレプリケーション)に置き換えられています。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;まだ、SambaにはFRSにも、DFS-Rにも、SYSVOLレプリケーションは含まれていません。&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DFS-Rはしばしば、DFS(下記参照)のサブ機能とみなされており、両方共一緒に使用されますが、完全に別々に使用することもできます:&lt;br /&gt;
複数のターゲットを持つDFSは、DFS-Rなしで使用することが可能(フォルダーの内容が別の方法で更新された場合でも)で、DFS-RはDFSターゲットでない共有フォルダを複製できます。&lt;br /&gt;
&lt;br /&gt;
Sambaは、DFSを部分的にサポートしますが、DFS-Rはまだサポートしていません。&lt;br /&gt;
&lt;br /&gt;
== DFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What is DFS ===&lt;br /&gt;
&lt;br /&gt;
DFS (Distributed File System) is a feature that provides several functions:&lt;br /&gt;
alternative name space, load balancing, and automatic failover.&lt;br /&gt;
&lt;br /&gt;
Technically DFS provides access to a shared directory that contains no files,&lt;br /&gt;
only junctions, and optionally subdirectories with more junctions.&lt;br /&gt;
Junctions are similar to soft links as known from Unix file systems, &lt;br /&gt;
but ones that point to shared directories, and they can also point&lt;br /&gt;
to shared directories on other servers. The clients first ask the&lt;br /&gt;
DFS server for the junction, then access the file server where this&lt;br /&gt;
junction points to.&lt;br /&gt;
&lt;br /&gt;
The main use of this is to create an alternative name space (directory tree view),&lt;br /&gt;
that hides details of the underlying infrastructure from the users.&lt;br /&gt;
The paths that the users see (called DFS names) do not change when servers are renamed, &lt;br /&gt;
or when some of the directories are moved to a different server.&lt;br /&gt;
The administrators can simply replace the outdated DFS name with a new one,&lt;br /&gt;
that points to the new target.&lt;br /&gt;
&lt;br /&gt;
A DFS name can optionally point to more than one target&lt;br /&gt;
(i.e. tell the client several alternative junctions to different shared folders).&lt;br /&gt;
In this case clients can access either of the targets. This provides&lt;br /&gt;
load balancing, and automatic failover to another server, if one server fails. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== stand-alone versus domain-based DFS ===&lt;br /&gt;
&lt;br /&gt;
DFS can be either stand-alone, or domain-based.&lt;br /&gt;
&lt;br /&gt;
The stand-alone variant runs on one single server and &lt;br /&gt;
causes the DFS names to contain the name of that server,&lt;br /&gt;
they look like shares that are provided by that server.&lt;br /&gt;
&lt;br /&gt;
The domain based setup causes the DFS names to contain only the&lt;br /&gt;
name of the domain, not the name of any specific server. Several&lt;br /&gt;
servers in the domain can act as DFS servers in parallel.&lt;br /&gt;
Clients automatically select one of the DFS servers and send &lt;br /&gt;
their queries to that one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configure stand-alone DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The method to set up the stand-alone variant with Samba is described here:&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/msdfs.html&lt;br /&gt;
&lt;br /&gt;
In short it requires in the config file smb.conf the global option &lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
(which is default on AD-DCs)&lt;br /&gt;
and in one share declaration the two options&lt;br /&gt;
  path = /export/dfsroot&lt;br /&gt;
  msdfs root = yes&lt;br /&gt;
Then in the specified path create entries by running commands like&lt;br /&gt;
  ln -s msdfs:storage0\\share0 linka&lt;br /&gt;
  ln -s msdfs:server1\\share,server2\\share linkb&lt;br /&gt;
&lt;br /&gt;
The first example defines one target, the second example creates two&lt;br /&gt;
alternative targets that share the same contents.&lt;br /&gt;
&lt;br /&gt;
Windows clients will see these as junctions.&lt;br /&gt;
&lt;br /&gt;
=== Configure Member server DFS in Samba ===&lt;br /&gt;
  &lt;br /&gt;
Similar to above but required one additional setting in smb.conf the global option so it would be&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
  vfs object = dfs_samba4&lt;br /&gt;
&lt;br /&gt;
Other just follow what happen on above.&lt;br /&gt;
&lt;br /&gt;
=== Configure domain-based DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The procedure is the same as for stand-alone DFS, but it requires the vfs_object dfs_samba4 (which is default in AD-DC, but beware of the pitfalls of the &amp;lt;code&amp;gt;vfs object&amp;lt;/code&amp;gt; option),&lt;br /&gt;
and the DFS names must be declared on each DC&lt;br /&gt;
([https://lists.samba.org/archive/samba/2014-June/182705.html because the endpointmapper for DFS is not implemented]).&lt;br /&gt;
&lt;br /&gt;
There is currently (July 2014) a discussion in the mailing list in which several users report great difficulties with domain-based DFS in samba 4, maybe related with the implementation of smb protocol version 3.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
Neither the path dfsroot specified in the DFS share, nor any&lt;br /&gt;
of the share paths in the ln-commands must contain upper case characters.&lt;br /&gt;
The links might be allowed to contain upper case characters.&lt;br /&gt;
&lt;br /&gt;
DFS works only for Administrator in Samba 4.1.4, and &lt;br /&gt;
[https://groups.google.com/forum/?_escaped_fragment_=topic/linux.samba/mi4O5lHE8Vc#!topic/linux.samba/mi4O5lHE8Vc requires a patch] to work for all users.&lt;br /&gt;
&lt;br /&gt;
There is currently an ongoing discussion in the mailing list whether or not domain-based DFS really works.&lt;br /&gt;
&lt;br /&gt;
DFS-R (replication) is not yet implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10035</id>
		<title>分散ファイルシステム(DFS)</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=%E5%88%86%E6%95%A3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0(DFS)&amp;diff=10035"/>
		<updated>2019-03-11T14:04:33Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: ページの作成:「== FRS versus DFS versus DFS-R ==  FRS (File Replication Service) is used to replicate SYSVOL  in Windows Server 2000 and 2003. It is slowly being replaced  by Microsoft…」&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== FRS versus DFS versus DFS-R ==&lt;br /&gt;
&lt;br /&gt;
FRS (File Replication Service) is used to replicate SYSVOL &lt;br /&gt;
in Windows Server 2000 and 2003. It is slowly being replaced &lt;br /&gt;
by Microsoft with DFS-R (Distributed File System Replication)&lt;br /&gt;
in newer versions of Windows Server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Samba does not yet include SYSVOL replication, &lt;br /&gt;
neither with FRS, nor with DFS-R.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DFS-R is often viewed as subfunction of DFS (see below), and both are often&lt;br /&gt;
used together, but they can also be used completely separately:&lt;br /&gt;
DFS with multiple targets can be used without DFS-R (if the folder &lt;br /&gt;
contents are updated with some other method), and DFS-R can &lt;br /&gt;
replicate shared folders that are not DFS-targets.&lt;br /&gt;
&lt;br /&gt;
Samba partially supports DFS, but not DFS-R yet.&lt;br /&gt;
&lt;br /&gt;
== DFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What is DFS ===&lt;br /&gt;
&lt;br /&gt;
DFS (Distributed File System) is a feature that provides several functions:&lt;br /&gt;
alternative name space, load balancing, and automatic failover.&lt;br /&gt;
&lt;br /&gt;
Technically DFS provides access to a shared directory that contains no files,&lt;br /&gt;
only junctions, and optionally subdirectories with more junctions.&lt;br /&gt;
Junctions are similar to soft links as known from Unix file systems, &lt;br /&gt;
but ones that point to shared directories, and they can also point&lt;br /&gt;
to shared directories on other servers. The clients first ask the&lt;br /&gt;
DFS server for the junction, then access the file server where this&lt;br /&gt;
junction points to.&lt;br /&gt;
&lt;br /&gt;
The main use of this is to create an alternative name space (directory tree view),&lt;br /&gt;
that hides details of the underlying infrastructure from the users.&lt;br /&gt;
The paths that the users see (called DFS names) do not change when servers are renamed, &lt;br /&gt;
or when some of the directories are moved to a different server.&lt;br /&gt;
The administrators can simply replace the outdated DFS name with a new one,&lt;br /&gt;
that points to the new target.&lt;br /&gt;
&lt;br /&gt;
A DFS name can optionally point to more than one target&lt;br /&gt;
(i.e. tell the client several alternative junctions to different shared folders).&lt;br /&gt;
In this case clients can access either of the targets. This provides&lt;br /&gt;
load balancing, and automatic failover to another server, if one server fails. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== stand-alone versus domain-based DFS ===&lt;br /&gt;
&lt;br /&gt;
DFS can be either stand-alone, or domain-based.&lt;br /&gt;
&lt;br /&gt;
The stand-alone variant runs on one single server and &lt;br /&gt;
causes the DFS names to contain the name of that server,&lt;br /&gt;
they look like shares that are provided by that server.&lt;br /&gt;
&lt;br /&gt;
The domain based setup causes the DFS names to contain only the&lt;br /&gt;
name of the domain, not the name of any specific server. Several&lt;br /&gt;
servers in the domain can act as DFS servers in parallel.&lt;br /&gt;
Clients automatically select one of the DFS servers and send &lt;br /&gt;
their queries to that one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configure stand-alone DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The method to set up the stand-alone variant with Samba is described here:&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/msdfs.html&lt;br /&gt;
&lt;br /&gt;
In short it requires in the config file smb.conf the global option &lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
(which is default on AD-DCs)&lt;br /&gt;
and in one share declaration the two options&lt;br /&gt;
  path = /export/dfsroot&lt;br /&gt;
  msdfs root = yes&lt;br /&gt;
Then in the specified path create entries by running commands like&lt;br /&gt;
  ln -s msdfs:storage0\\share0 linka&lt;br /&gt;
  ln -s msdfs:server1\\share,server2\\share linkb&lt;br /&gt;
&lt;br /&gt;
The first example defines one target, the second example creates two&lt;br /&gt;
alternative targets that share the same contents.&lt;br /&gt;
&lt;br /&gt;
Windows clients will see these as junctions.&lt;br /&gt;
&lt;br /&gt;
=== Configure Member server DFS in Samba ===&lt;br /&gt;
  &lt;br /&gt;
Similar to above but required one additional setting in smb.conf the global option so it would be&lt;br /&gt;
  host msdfs = yes&lt;br /&gt;
  vfs object = dfs_samba4&lt;br /&gt;
&lt;br /&gt;
Other just follow what happen on above.&lt;br /&gt;
&lt;br /&gt;
=== Configure domain-based DFS in Samba ===&lt;br /&gt;
&lt;br /&gt;
The procedure is the same as for stand-alone DFS, but it requires the vfs_object dfs_samba4 (which is default in AD-DC, but beware of the pitfalls of the &amp;lt;code&amp;gt;vfs object&amp;lt;/code&amp;gt; option),&lt;br /&gt;
and the DFS names must be declared on each DC&lt;br /&gt;
([https://lists.samba.org/archive/samba/2014-June/182705.html because the endpointmapper for DFS is not implemented]).&lt;br /&gt;
&lt;br /&gt;
There is currently (July 2014) a discussion in the mailing list in which several users report great difficulties with domain-based DFS in samba 4, maybe related with the implementation of smb protocol version 3.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
Neither the path dfsroot specified in the DFS share, nor any&lt;br /&gt;
of the share paths in the ln-commands must contain upper case characters.&lt;br /&gt;
The links might be allowed to contain upper case characters.&lt;br /&gt;
&lt;br /&gt;
DFS works only for Administrator in Samba 4.1.4, and &lt;br /&gt;
[https://groups.google.com/forum/?_escaped_fragment_=topic/linux.samba/mi4O5lHE8Vc#!topic/linux.samba/mi4O5lHE8Vc requires a patch] to work for all users.&lt;br /&gt;
&lt;br /&gt;
There is currently an ongoing discussion in the mailing list whether or not domain-based DFS really works.&lt;br /&gt;
&lt;br /&gt;
DFS-R (replication) is not yet implemented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=SambaWiki%E7%BF%BB%E8%A8%B3&amp;diff=10034</id>
		<title>SambaWiki翻訳</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=SambaWiki%E7%BF%BB%E8%A8%B3&amp;diff=10034"/>
		<updated>2019-03-11T14:04:02Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://wiki.samba.org/ Samba Wiki]のドキュメントの一部を翻訳したものです。&lt;br /&gt;
&lt;br /&gt;
※ あくまで雑廉堂個人の覚書用です。&lt;br /&gt;
&lt;br /&gt;
* [[Sambaのインストール]]&lt;br /&gt;
:* [[ディストリビューション固有のパッケージインストール]]&lt;br /&gt;
* [[Sambaの更新]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[ドメインコントロール]]&lt;br /&gt;
:* [[Active Directory  Domain Controller]]&lt;br /&gt;
::* [[Active Directoryの名前付けに関するよくある質問]]&lt;br /&gt;
::* [[SambaをActive Directoryドメインコントローラとして設定する]]&lt;br /&gt;
::* [[Samba DCを既存のActive Directoryに参加させる]]&lt;br /&gt;
:::* [[DC DNSレコードの確認と作成]]&lt;br /&gt;
::* [[Samba AD DNSバックエンド]]&lt;br /&gt;
:::* [[Samba内部DNSバックエンド]]&lt;br /&gt;
:::* [[BIND9 DLZ DNSバックエンド]]&lt;br /&gt;
::::* [[BIND DNSサーバーの設定]]&lt;br /&gt;
::::* [[BIND9 DLZ AppArmorとSELinux統合]]&lt;br /&gt;
:::* [[動的DNS更新のテスト]]&lt;br /&gt;
:::* [[BIND9 FLATFILE DNSバックエンド]]&lt;br /&gt;
::* [[Samba AD DC上でのWinbinddの設定]]&lt;br /&gt;
::* [[時刻の同期]]&lt;br /&gt;
:::* [[時刻の同期-SELinuxでのラベル付とポリシー]]&lt;br /&gt;
::* [[ディレクトリ複製の状態の確認]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[ドメインメンバーシップ]]&lt;br /&gt;
:* [[Windowsクライアント、サーバーをドメインに参加させる]]&lt;br /&gt;
::* [[WindowsでのDNS設定]]&lt;br /&gt;
:* [[Linux、あるいはUnixホストをドメインに参加せせる]]&lt;br /&gt;
::* [[LinuxとUnixでのDNS設定]]&lt;br /&gt;
::* &amp;lt;del&amp;gt;[[SambaをActive Directoryドメインメンバとして構成する]]&amp;lt;/del&amp;gt;&lt;br /&gt;
::* [[Sambaをドメインメンバーとして設定]]&lt;br /&gt;
:::* [[ID Mappingのバックエンド]]&lt;br /&gt;
::::* [[idmap config ad]] (RFC2307)&lt;br /&gt;
::::* [[idmap config rid]]&lt;br /&gt;
::::* [[idmap config autorid]]&lt;br /&gt;
::::* [[Local accounts]]&lt;br /&gt;
:::* [[PAMを使用したドメインユーザーの認証]]&lt;br /&gt;
:::* [[PAM Offline Authentication]]&lt;br /&gt;
::* [[Samba Domain Member Port Usage]]&lt;br /&gt;
:* [[Joining a Mac OS X Client to a Domain]]&lt;br /&gt;
::* [[Mac OS X DNS Configuration]]&lt;br /&gt;
:* [[Configuring FreeDOS to Access a Samba Share]]&lt;br /&gt;
:* [[Sambaドメインメンバのトラブルシューティング]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[上級者向けの設定]]&lt;br /&gt;
:* [[DNSの管理]]&lt;br /&gt;
::* [[Samba AD DCのDNSバックエンドの変更]]&lt;br /&gt;
::* [[DNSの管理]]&lt;br /&gt;
::* [[DNSによる名前解決のテスト]]&lt;br /&gt;
::* [[DNSトラブルシューティング]]&lt;br /&gt;
:::* [[dns tkey negotiategss tkey is un acceptable]]&lt;br /&gt;
:* [[ADにRFC2307を設定する]]&lt;br /&gt;
:* [[プリントサーバーサポート]]&lt;br /&gt;
::* [[Sambaをプリントサーバとして設定する]]&lt;br /&gt;
::* [[Windowsクライアント用の自動プリンタドライバのダウンロードをセットアップする]]&lt;br /&gt;
:* [[Active Directoryサイト]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[レプリケーション]]&lt;br /&gt;
:* [[分散ファイルシステム(DFS)]]&lt;br /&gt;
::* [[Sysvolレプリケーション（DFS-R）]]&lt;br /&gt;
:::* [[RsyncベースのSysvolレプリケーションの回避策]](Samba DCs Only)&lt;br /&gt;
:::* [[双方向のRsync/UnisonベースのSysvolレプリケーション回避策]](Samba DCs Only)&lt;br /&gt;
:::* [[双方向のRsync/osyncベースのSysvolレプリケーション回避策]](Samba DCs Only)&lt;br /&gt;
:::* [[RobocopyベースのSysvolレプリケーション回避策]](Samba DCs -&amp;gt; Windows DCs)&lt;br /&gt;
:* [[ディレクトリレプリケーションサービス(DRS)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[一般的な管理タスク]]&lt;br /&gt;
:* [[Windowsリモートサーバー管理ツール（RSAT)]]&lt;br /&gt;
::* [[RSATのインストール]]&lt;br /&gt;
:* [[Sambaのリモートとローカルの管理]]&lt;br /&gt;
::* [[ユーザーとグループの管理]]&lt;br /&gt;
:::* [[ADUCを使用したADにおけるUnix属性の管理]]&lt;br /&gt;
:* [[バックアップとリストア]]&lt;br /&gt;
::* [[Samba AD DCのバックアップとリストア]]&lt;br /&gt;
:* [[Sambaファイルサーバ]]&lt;br /&gt;
::* [[Windows ACLs を利用して共有を設定する]]&lt;br /&gt;
::* [[POSIX ACLs を利用して共有を設定する]]&lt;br /&gt;
::* [[特別なファイル共有]]&lt;br /&gt;
:::* [[ユーザーホームフォルダ]]&lt;br /&gt;
:::* [[Windowsの移動ユーザープロファイル]]&lt;br /&gt;
::::* [[Windowsのプロファイルフォルダリダイレクションの設定]]&lt;br /&gt;
:::* [[認証のいらない共有の設定]]&lt;br /&gt;
:* [[Samba_AD_DCでLDAP_over_SSL(LDAPS)を構成する]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Libnss_winbind_%E3%83%AA%E3%83%B3%E3%82%AF&amp;diff=10033</id>
		<title>Libnss winbind リンク</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Libnss_winbind_%E3%83%AA%E3%83%B3%E3%82%AF&amp;diff=10033"/>
		<updated>2019-03-09T08:15:05Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://wiki.samba.org/index.php/Libnss_winbind_Links&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;= はじめに =&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sambaを自身でコンパイルした場合、ホストがWinbindを使用して、ドメインから、ユーザーとグループの情報を受け取れるようにするには、オペレーションシステムのライブラリパスのディレクトリに、2つのシンボリックリンクを作成する必要があります。ディストリビューションのパッケージからSambaを使用している場合は、Debianのlibpam-winbind と libnss-winbindのように、通常、これを行うためのディストリビューションのパッケージがあります。&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = notice&lt;br /&gt;
| style = margin: 4px 2%&lt;br /&gt;
| text = ライブラリをディレクトリにコピーしないでください。Sambaの更新の度に入れ替えなければいけなくなります。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= プラットフォームの決定 =&lt;br /&gt;
&lt;br /&gt;
オペレーティングシステムのプラットフォームを確認するには:&lt;br /&gt;
&lt;br /&gt;
 # uname -m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;code&amp;gt;libnss_winbind.so.2&amp;lt;/code&amp;gt; ライブラリの場所を探す =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;libnss_winbind.so.2&amp;lt;/code&amp;gt;は、コンパイル時にSambaのライブラリディレクトリにインストールされています。検索するには:&lt;br /&gt;
&lt;br /&gt;
 # smbd -b | grep LIBDIR&lt;br /&gt;
    LIBDIR: /usr/local/samba/lib/&lt;br /&gt;
&lt;br /&gt;
このディレクトリから、オペレーティングシステムのライブラリパスへリンクしてください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= オペレーティングシステム固有の例 =&lt;br /&gt;
&lt;br /&gt;
== Red Hat ベースのオペレーティングシステム ==&lt;br /&gt;
&lt;br /&gt;
=== x86_64 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib64/&lt;br /&gt;
 # ln -s /lib64/libnss_winbind.so.2 /lib64/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== i686 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/&lt;br /&gt;
 # ln -s /lib/libnss_winbind.so.2 /lib/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Debian ベースのオペレーティングシステム ==&lt;br /&gt;
&lt;br /&gt;
=== x86_64 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/x86_64-linux-gnu/&lt;br /&gt;
 # ln -s /lib/x86_64-linux-gnu/libnss_winbind.so.2 /lib/x86_64-linux-gnu/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== i686 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/i386-linux-gnu/&lt;br /&gt;
 # ln -s /lib/i386-linux-gnu/libnss_winbind.so.2 /lib/i386-linux-gnu/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ARM ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/arm-linux-gnueabihf/&lt;br /&gt;
 # ln -s /lib/arm-linux-gnueabihf/libnss_winbind.so.2 /lib/arm-linux-gnueabihf/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SUSE ベースのオペレーティングシステム ==&lt;br /&gt;
&lt;br /&gt;
=== x86_64 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib64/&lt;br /&gt;
 # ln -s /lib64/libnss_winbind.so.2 /lib64/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== i686 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/&lt;br /&gt;
 # ln -s /lib/libnss_winbind.so.2 /lib/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Libnss_winbind_%E3%83%AA%E3%83%B3%E3%82%AF&amp;diff=10032</id>
		<title>Libnss winbind リンク</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Libnss_winbind_%E3%83%AA%E3%83%B3%E3%82%AF&amp;diff=10032"/>
		<updated>2019-03-09T07:36:38Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://wiki.samba.org/index.php/Libnss_winbind_Links&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;= Introduction =&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you compile Samba yourself, to enable hosts to receive user and group information from a domain using Winbind, you must create two symbolic links in a directory of the operating system&#039;s library path. If you are are using Samba packages from your distro, there are usually distro packages to do this for you e.g. libpam-winbind and libnss-winbind on Debian.&lt;br /&gt;
&lt;br /&gt;
{{Imbox&lt;br /&gt;
| type = note&lt;br /&gt;
| text = Do not copy the library to the directory. Otherwise you must replace it manually after every Samba update.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Determining the Platform =&lt;br /&gt;
&lt;br /&gt;
To determine the operating system&#039;s platform:&lt;br /&gt;
&lt;br /&gt;
 # uname -m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Locating the &amp;lt;code&amp;gt;libnss_winbind.so.2&amp;lt;/code&amp;gt; Library =&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;libnss_winbind.so.2&amp;lt;/code&amp;gt; library is installed in the Samba library directory set at compile time. To locate the folder:&lt;br /&gt;
&lt;br /&gt;
 # smbd -b | grep LIBDIR&lt;br /&gt;
    LIBDIR: /usr/local/samba/lib/&lt;br /&gt;
&lt;br /&gt;
Link the library from this directory in your operating system&#039;s library directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Operating System-specific Examples =&lt;br /&gt;
&lt;br /&gt;
== Red Hat-based Operating Systems ==&lt;br /&gt;
&lt;br /&gt;
=== x86_64 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib64/&lt;br /&gt;
 # ln -s /lib64/libnss_winbind.so.2 /lib64/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== i686 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/&lt;br /&gt;
 # ln -s /lib/libnss_winbind.so.2 /lib/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Debian-based Operating Systems ==&lt;br /&gt;
&lt;br /&gt;
=== x86_64 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/x86_64-linux-gnu/&lt;br /&gt;
 # ln -s /lib/x86_64-linux-gnu/libnss_winbind.so.2 /lib/x86_64-linux-gnu/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== i686 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/i386-linux-gnu/&lt;br /&gt;
 # ln -s /lib/i386-linux-gnu/libnss_winbind.so.2 /lib/i386-linux-gnu/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ARM ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/arm-linux-gnueabihf/&lt;br /&gt;
 # ln -s /lib/arm-linux-gnueabihf/libnss_winbind.so.2 /lib/arm-linux-gnueabihf/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SUSE-based Operating Systems ==&lt;br /&gt;
&lt;br /&gt;
=== x86_64 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib64/&lt;br /&gt;
 # ln -s /lib64/libnss_winbind.so.2 /lib64/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== i686 ===&lt;br /&gt;
&lt;br /&gt;
 # ln -s /usr/local/samba/lib/libnss_winbind.so.2 /lib/&lt;br /&gt;
 # ln -s /lib/libnss_winbind.so.2 /lib/libnss_winbind.so&lt;br /&gt;
 # ldconfig&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E4%B8%8A%E3%81%A7%E3%81%AEWinbindd%E3%81%AE%E8%A8%AD%E5%AE%9A&amp;diff=10031</id>
		<title>Samba AD DC上でのWinbinddの設定</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E4%B8%8A%E3%81%A7%E3%81%AEWinbindd%E3%81%AE%E8%A8%AD%E5%AE%9A&amp;diff=10031"/>
		<updated>2019-03-09T07:33:52Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;サービスを使用すると、次のことが可能になります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;chown&amp;lt;/code&amp;gt; や&amp;lt;code&amp;gt;chgrp&amp;lt;/code&amp;gt; などのローカルコマンドでドメインユーザやドメイングループを使用できます。&lt;br /&gt;
* &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; コマンド等で、ドメインユーザやグループを表示できます。&lt;br /&gt;
&lt;br /&gt;
Samba アクティブディレクトリ(AD)ドメインコントローラ(DC)での&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;の構成は、ドメインメンバの場合とは異なります。ドメインメンバとしてサービスを設定するには、[[Sambaをドメインメンバとして構成する]] を参照して下さい。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Winbind と Winbinddサービスとの違い==&lt;br /&gt;
&lt;br /&gt;
Samba 4.0と4.1は、&amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;コマンドに組み込まれた新しい&amp;lt;code&amp;gt;Winbind&amp;lt;/code&amp;gt;実装を使用していました。 しかし、この実装は正&lt;br /&gt;
しく機能しませんでした。 このため、Samba 4.2では&amp;lt;code&amp;gt;winbindd&amp;lt;/code&amp;gt;ユーティリティをドメインコントローラ（DC）で使用することがで&lt;br /&gt;
きました。 Samba 4.2よりも前のSambaを実行している場合、&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;を使用する前に、サポートされているバージョンに更新してください。 詳細は、「[[Sambaの更新]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sambaドメインコントローラ上でのIDマッピング ==&lt;br /&gt;
&lt;br /&gt;
IDマッピングは、Samba ドメインコントローラ(DC)では、ドメインメンバの場合とは異なる動作をします。例えば、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; ファイルで&amp;lt;code&amp;gt;ad&amp;lt;/code&amp;gt;(rfc2307)や&amp;lt;code&amp;gt;rid&amp;lt;/code&amp;gt;などのIDマッピングバックエンドを構成することはサポートされていないため、&amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;サービスが失敗する可能性があります。詳細については「[[Sambaの更新#idmap configパラメータがsmb.confファイルで設定されているとドメインコントローラ上の共有にアクセスできない|idmap configパラメータがsmb.confファイルで設定されているとドメインコントローラ上の共有にアクセスできない]]」を参照して下さい&lt;br /&gt;
&lt;br /&gt;
SambaアクティブディレクトリDCでは、&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;は常にユーザID(&amp;lt;code&amp;gt;UID&amp;lt;/code&amp;gt;)およびグループID(&amp;lt;code&amp;gt;GID&amp;lt;/code&amp;gt;)を、ADオブジェクトに設定された&amp;lt;code&amp;gt;uidNumber&amp;lt;/code&amp;gt;および&amp;lt;code&amp;gt;gidNumber&amp;lt;/code&amp;gt;属性で設定された値から、読み取ります。&amp;lt;code&amp;gt;UID&amp;lt;/code&amp;gt;または&amp;lt;code&amp;gt;GID&amp;lt;/code&amp;gt;が割りあてられていないユーザ、及びグループの場合、IDはDC上でローカルに作成され、&amp;lt;code&amp;gt;/usr/local/samba/private/idmap.ldb&amp;lt;/code&amp;gt;に格納されます。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text  = ローカルIDが生成された後にADオブジェクトのプロパティにIDを設定すると、Winbinddはwinbinddのキャッシュの有効期限が切れた後、または&amp;lt;code&amp;gt;net cache flush&amp;lt;/code&amp;gt;を手動で実行した後にディレクトリの値を使用します。&lt;br /&gt;
オペレーティングシステムは、IDを使用してファイルの所有権を管理します。ユーザーが新しいIDを使用してファイルにアクセスできるように、ファイルのアクセス許可を手動でリセットする必要があります。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= smb.confファイルでの&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;パラメータの設定 =&lt;br /&gt;
&lt;br /&gt;
Samba Active Directory（AD）ドメインコントローラ（DC）上で&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;を実行するには、ほとんどの場合、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt;ファイルの設定は必要ありません。&lt;br /&gt;
&lt;br /&gt;
ユーザーIDとグループIDは、Active Directory（AD）からロードされるか、ローカルで自動的に生成されます。詳細については、「[[#Sambaドメインコントローラ上でのIDマッピング|Sambaドメインコントローラ上でのIDマッピング]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
Samba DCでは、winbindテンプレートモードのみがサポートされています。このモードでは、すべてのユーザーが以下を取得します。&lt;br /&gt;
&lt;br /&gt;
* 割り当てられたホームディレクトリパス。&amp;lt;code&amp;gt;template homedir&amp;lt;/code&amp;gt;パラメータで設定します。このパラメータのデフォルト値は&amp;lt;code&amp;gt;/home/%D/%U&amp;lt;/code&amp;gt;です。&lt;br /&gt;
* 割り当てられたシェル。&amp;lt;code&amp;gt;template shell&amp;lt;/code&amp;gt;パラメーターで設定します。このパラメータのデフォルト値は&amp;lt;code&amp;gt;/bin/false&amp;lt;/code&amp;gt;です。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;が提供するすべてのドメインユーザーにログオンシェルとして&amp;lt;code&amp;gt;/bin/bash&amp;lt;/code&amp;gt;と、ホームディレクトリパスとし&lt;br /&gt;
て &amp;lt;code&amp;gt;/home/%U&amp;lt;/code&amp;gt;を割り当てるには：&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt;ファイルの&amp;lt;code&amp;gt;[global]&amp;lt;/code&amp;gt;セクションに次のパラメータを追加します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;    template shell = /bin/bash&lt;br /&gt;
    template homedir = /home/%U&amp;lt;/pre&amp;gt;&lt;br /&gt;
詳細は、&amp;lt;code&amp;gt;smb.conf（5）&amp;lt;/code&amp;gt;のマニュアルページを参照してください。&lt;br /&gt;
&lt;br /&gt;
* sambaサービスを再起動します。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| type  = speedy&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text  = Samba AD DCでは、&amp;lt;code&amp;gt;smb.conf（5）&amp;lt;/code&amp;gt;のマニュアルページに記載されているすべての&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;関連パラメータがサポートされているわけではありません。さらに、&amp;lt;code&amp;gt;idmap config&amp;lt;/code&amp;gt;などの一部のパラメータでは、&amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;サービスが失敗する可能性があります。現在、マニュアルページでは、DCでサポートされているパラメータは強調表示されていません。したがって、デフォルトを維持するか、このセクションで説明するパラメータのみを使用することをお勧めします。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Libnss winbindリンク =&lt;br /&gt;
&lt;br /&gt;
{{:Libnss_winbind_リンク}}&lt;br /&gt;
&lt;br /&gt;
= ネームサービススイッチの設定 =&lt;br /&gt;
&lt;br /&gt;
ネームサービススイッチ（NSS）ライブラリを有効にして、ドメインユーザとグループをローカルシステムで使用できるようにするには：&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/etc/nsswitch.conf&amp;lt;/code&amp;gt;ファイルの次のデータベースに&amp;lt;code&amp;gt;winbind&amp;lt;/code&amp;gt;エントリを追加します。&lt;br /&gt;
&lt;br /&gt;
 passwd: files &amp;lt;u&amp;gt;winbind&amp;lt;/u&amp;gt;&lt;br /&gt;
 group:  files &amp;lt;u&amp;gt;winbind&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* 両方のデータベースの最初のソースとして&amp;lt;code&amp;gt;files&amp;lt;/code&amp;gt;エントリを保持します。 これにより、NSSはWinbindサービスを照会する前に&amp;lt;code&amp;gt;/etc/passwd&amp;lt;/code&amp;gt;および&amp;lt;code&amp;gt;/etc/group&amp;lt;/code&amp;gt;ファイルからドメインユーザーとグループを検索できます。&lt;br /&gt;
:* &amp;lt;code&amp;gt;winbind&amp;lt;/code&amp;gt;エントリをNSS &amp;lt;code&amp;gt;shadow&amp;lt;/code&amp;gt;データベースに追加しないでください。 これにより、&amp;lt;code&amp;gt;wbinfo&amp;lt;/code&amp;gt;ユーティリティが失敗する可能性があります。&lt;br /&gt;
:* Sambaをコンパイルした場合、&amp;lt;code&amp;gt;libnss_winbind&amp;lt;/code&amp;gt;ライブラリからOSのシステムライブラリパスにシンボリックリンクを追加してください。詳細は、[[Libnss_winbind_リンク|Libnss winbind リンク]]を参照してください。Sambaのインストールにパッケージを使用した場合は、リンクは自動的に作成されます。&lt;br /&gt;
&lt;br /&gt;
{{ imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text  = ローカルの&amp;lt;code&amp;gt;/etc/passwd&amp;lt;/code&amp;gt;ファイルでドメインと同じユーザー名を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= winbinddサービス =&lt;br /&gt;
&lt;br /&gt;
Samba Active Directory（AD）ドメインコントローラ（DC）で&amp;lt;code&amp;gt;winbindd&amp;lt;/code&amp;gt;サービスを手動で起動しないでください。 このサービスは、&amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;プロセスのサブプロセスとして自動的に開始されます。 確認するには、次を入力します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# ps axf&lt;br /&gt;
...&lt;br /&gt;
2156 ?        Ss     0:00 /usr/local/samba/sbin/samba -D&lt;br /&gt;
2158 ?        S      0:00  \_ /usr/local/samba/sbin/samba -D&lt;br /&gt;
2172 ?        R      0:00      \_ /usr/local/samba/sbin/winbindd -D --option=server role check:inhibit=yes --foreground&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Winbindd接続のテスト =&lt;br /&gt;
[[Sambaをドメインメンバーとして設定#Winbindへの接続を確認|Winbindへの接続を確認]]を参照。&lt;br /&gt;
&lt;br /&gt;
= PAMを利用したドメインユーザーの認証 =&lt;br /&gt;
&lt;br /&gt;
[[PAMを使用したドメインユーザーの認証]]を参照。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
	<entry>
		<id>https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E4%B8%8A%E3%81%A7%E3%81%AEWinbindd%E3%81%AE%E8%A8%AD%E5%AE%9A&amp;diff=10030</id>
		<title>Samba AD DC上でのWinbinddの設定</title>
		<link rel="alternate" type="text/html" href="https://www.rough-and-cheap.jp/mediawiki/index.php?title=Samba_AD_DC%E4%B8%8A%E3%81%A7%E3%81%AEWinbindd%E3%81%AE%E8%A8%AD%E5%AE%9A&amp;diff=10030"/>
		<updated>2019-03-09T07:32:22Z</updated>

		<summary type="html">&lt;p&gt;Meisina04: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= はじめに =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;サービスを使用すると、次のことが可能になります。&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;chown&amp;lt;/code&amp;gt; や&amp;lt;code&amp;gt;chgrp&amp;lt;/code&amp;gt; などのローカルコマンドでドメインユーザやドメイングループを使用できます。&lt;br /&gt;
* &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; コマンド等で、ドメインユーザやグループを表示できます。&lt;br /&gt;
&lt;br /&gt;
Samba アクティブディレクトリ(AD)ドメインコントローラ(DC)での&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;の構成は、ドメインメンバの場合とは異なります。ドメインメンバとしてサービスを設定するには、[[Sambaをドメインメンバとして構成する]] を参照して下さい。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Winbind と Winbinddサービスとの違い==&lt;br /&gt;
&lt;br /&gt;
Samba 4.0と4.1は、&amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;コマンドに組み込まれた新しい&amp;lt;code&amp;gt;Winbind&amp;lt;/code&amp;gt;実装を使用していました。 しかし、この実装は正&lt;br /&gt;
しく機能しませんでした。 このため、Samba 4.2では&amp;lt;code&amp;gt;winbindd&amp;lt;/code&amp;gt;ユーティリティをドメインコントローラ（DC）で使用することがで&lt;br /&gt;
きました。 Samba 4.2よりも前のSambaを実行している場合、&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;を使用する前に、サポートされているバージョンに更新してください。 詳細は、「[[Sambaの更新]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sambaドメインコントローラ上でのIDマッピング =&lt;br /&gt;
&lt;br /&gt;
IDマッピングは、Samba ドメインコントローラ(DC)では、ドメインメンバの場合とは異なる動作をします。例えば、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt; ファイルで&amp;lt;code&amp;gt;ad&amp;lt;/code&amp;gt;(rfc2307)や&amp;lt;code&amp;gt;rid&amp;lt;/code&amp;gt;などのIDマッピングバックエンドを構成することはサポートされていないため、&amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;サービスが失敗する可能性があります。詳細については「[[Sambaの更新#idmap configパラメータがsmb.confファイルで設定されているとドメインコントローラ上の共有にアクセスできない|idmap configパラメータがsmb.confファイルで設定されているとドメインコントローラ上の共有にアクセスできない]]」を参照して下さい&lt;br /&gt;
&lt;br /&gt;
SambaアクティブディレクトリDCでは、&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;は常にユーザID(&amp;lt;code&amp;gt;UID&amp;lt;/code&amp;gt;)およびグループID(&amp;lt;code&amp;gt;GID&amp;lt;/code&amp;gt;)を、ADオブジェクトに設定された&amp;lt;code&amp;gt;uidNumber&amp;lt;/code&amp;gt;および&amp;lt;code&amp;gt;gidNumber&amp;lt;/code&amp;gt;属性で設定された値から、読み取ります。&amp;lt;code&amp;gt;UID&amp;lt;/code&amp;gt;または&amp;lt;code&amp;gt;GID&amp;lt;/code&amp;gt;が割りあてられていないユーザ、及びグループの場合、IDはDC上でローカルに作成され、&amp;lt;code&amp;gt;/usr/local/samba/private/idmap.ldb&amp;lt;/code&amp;gt;に格納されます。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text  = ローカルIDが生成された後にADオブジェクトのプロパティにIDを設定すると、Winbinddはwinbinddのキャッシュの有効期限が切れた後、または&amp;lt;code&amp;gt;net cache flush&amp;lt;/code&amp;gt;を手動で実行した後にディレクトリの値を使用します。&lt;br /&gt;
オペレーティングシステムは、IDを使用してファイルの所有権を管理します。ユーザーが新しいIDを使用してファイルにアクセスできるように、ファイルのアクセス許可を手動でリセットする必要があります。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= smb.confファイルでの&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;パラメータの設定 =&lt;br /&gt;
&lt;br /&gt;
Samba Active Directory（AD）ドメインコントローラ（DC）上で&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;を実行するには、ほとんどの場合、&amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt;ファイルの設定は必要ありません。&lt;br /&gt;
&lt;br /&gt;
ユーザーIDとグループIDは、Active Directory（AD）からロードされるか、ローカルで自動的に生成されます。詳細については、「[[#Sambaドメインコントローラ上でのIDマッピング|Sambaドメインコントローラ上でのIDマッピング]]」を参照してください。&lt;br /&gt;
&lt;br /&gt;
Samba DCでは、winbindテンプレートモードのみがサポートされています。このモードでは、すべてのユーザーが以下を取得します。&lt;br /&gt;
&lt;br /&gt;
* 割り当てられたホームディレクトリパス。&amp;lt;code&amp;gt;template homedir&amp;lt;/code&amp;gt;パラメータで設定します。このパラメータのデフォルト値は&amp;lt;code&amp;gt;/home/%D/%U&amp;lt;/code&amp;gt;です。&lt;br /&gt;
* 割り当てられたシェル。&amp;lt;code&amp;gt;template shell&amp;lt;/code&amp;gt;パラメーターで設定します。このパラメータのデフォルト値は&amp;lt;code&amp;gt;/bin/false&amp;lt;/code&amp;gt;です。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;が提供するすべてのドメインユーザーにログオンシェルとして&amp;lt;code&amp;gt;/bin/bash&amp;lt;/code&amp;gt;と、ホームディレクトリパスとし&lt;br /&gt;
て &amp;lt;code&amp;gt;/home/%U&amp;lt;/code&amp;gt;を割り当てるには：&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;smb.conf&amp;lt;/code&amp;gt;ファイルの&amp;lt;code&amp;gt;[global]&amp;lt;/code&amp;gt;セクションに次のパラメータを追加します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;    template shell = /bin/bash&lt;br /&gt;
    template homedir = /home/%U&amp;lt;/pre&amp;gt;&lt;br /&gt;
詳細は、&amp;lt;code&amp;gt;smb.conf（5）&amp;lt;/code&amp;gt;のマニュアルページを参照してください。&lt;br /&gt;
&lt;br /&gt;
* sambaサービスを再起動します。&lt;br /&gt;
&lt;br /&gt;
{{imbox&lt;br /&gt;
| type  = speedy&lt;br /&gt;
| style = margin: 4px 2%;&lt;br /&gt;
| text  = Samba AD DCでは、&amp;lt;code&amp;gt;smb.conf（5）&amp;lt;/code&amp;gt;のマニュアルページに記載されているすべての&amp;lt;code&amp;gt;Winbindd&amp;lt;/code&amp;gt;関連パラメータがサポートされているわけではありません。さらに、&amp;lt;code&amp;gt;idmap config&amp;lt;/code&amp;gt;などの一部のパラメータでは、&amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;サービスが失敗する可能性があります。現在、マニュアルページでは、DCでサポートされているパラメータは強調表示されていません。したがって、デフォルトを維持するか、このセクションで説明するパラメータのみを使用することをお勧めします。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= Libnss winbindリンク =&lt;br /&gt;
&lt;br /&gt;
{{:Libnss_winbind_リンク}}&lt;br /&gt;
&lt;br /&gt;
= ネームサービススイッチの設定 =&lt;br /&gt;
&lt;br /&gt;
ネームサービススイッチ（NSS）ライブラリを有効にして、ドメインユーザとグループをローカルシステムで使用できるようにするには：&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/etc/nsswitch.conf&amp;lt;/code&amp;gt;ファイルの次のデータベースに&amp;lt;code&amp;gt;winbind&amp;lt;/code&amp;gt;エントリを追加します。&lt;br /&gt;
&lt;br /&gt;
 passwd: files &amp;lt;u&amp;gt;winbind&amp;lt;/u&amp;gt;&lt;br /&gt;
 group:  files &amp;lt;u&amp;gt;winbind&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* 両方のデータベースの最初のソースとして&amp;lt;code&amp;gt;files&amp;lt;/code&amp;gt;エントリを保持します。 これにより、NSSはWinbindサービスを照会する前に&amp;lt;code&amp;gt;/etc/passwd&amp;lt;/code&amp;gt;および&amp;lt;code&amp;gt;/etc/group&amp;lt;/code&amp;gt;ファイルからドメインユーザーとグループを検索できます。&lt;br /&gt;
:* &amp;lt;code&amp;gt;winbind&amp;lt;/code&amp;gt;エントリをNSS &amp;lt;code&amp;gt;shadow&amp;lt;/code&amp;gt;データベースに追加しないでください。 これにより、&amp;lt;code&amp;gt;wbinfo&amp;lt;/code&amp;gt;ユーティリティが失敗する可能性があります。&lt;br /&gt;
:* Sambaをコンパイルした場合、&amp;lt;code&amp;gt;libnss_winbind&amp;lt;/code&amp;gt;ライブラリからOSのシステムライブラリパスにシンボリックリンクを追加してください。詳細は、[[Libnss_winbind_リンク|Libnss winbind リンク]]を参照してください。Sambaのインストールにパッケージを使用した場合は、リンクは自動的に作成されます。&lt;br /&gt;
&lt;br /&gt;
{{ imbox&lt;br /&gt;
| style = margin:4px 2%;&lt;br /&gt;
| text  = ローカルの&amp;lt;code&amp;gt;/etc/passwd&amp;lt;/code&amp;gt;ファイルでドメインと同じユーザー名を使用しないでください。&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= winbinddサービス =&lt;br /&gt;
&lt;br /&gt;
Samba Active Directory（AD）ドメインコントローラ（DC）で&amp;lt;code&amp;gt;winbindd&amp;lt;/code&amp;gt;サービスを手動で起動しないでください。 このサービスは、&amp;lt;code&amp;gt;samba&amp;lt;/code&amp;gt;プロセスのサブプロセスとして自動的に開始されます。 確認するには、次を入力します。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# ps axf&lt;br /&gt;
...&lt;br /&gt;
2156 ?        Ss     0:00 /usr/local/samba/sbin/samba -D&lt;br /&gt;
2158 ?        S      0:00  \_ /usr/local/samba/sbin/samba -D&lt;br /&gt;
2172 ?        R      0:00      \_ /usr/local/samba/sbin/winbindd -D --option=server role check:inhibit=yes --foreground&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Winbindd接続のテスト =&lt;br /&gt;
[[Sambaをドメインメンバーとして設定#Winbindへの接続を確認|Winbindへの接続を確認]]を参照。&lt;br /&gt;
&lt;br /&gt;
= PAMを利用したドメインユーザーの認証 =&lt;br /&gt;
&lt;br /&gt;
[[PAMを使用したドメインユーザーの認証]]を参照。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Active Directory]]&lt;/div&gt;</summary>
		<author><name>Meisina04</name></author>
	</entry>
</feed>