「ユーザーホームフォルダ」の版間の差分

提供:雑廉堂Wiki
ページの作成:「= Introduction = Home folders contain files of an individual account. Using Samba, you can share the directories to enable network users to store own files on their home…」
 
 
(同じ利用者による、間の30版が非表示)
1行目: 1行目:
= Introduction =
= はじめに =


Home folders contain files of an individual account. Using Samba, you can share the directories to enable network users to store own files on their home folder on the file server.
ホームフォルダには、個々のアカウントのファイルが含まれています。Sambaを使用すると、ネットワークユーザーが自分のファイルを、ファイルサーバー上の自分のホームフォルダーに保存できるように、ディレクトリを共有できます。


This documentation does not use the Samba built-in <code>[homes]</code> section that dynamically shares the user's home directory using the <code>\\server\''user_name''\</code> path. While this can be helpful in certain scenarios, it has some disadvantages:
このドキュメントでは、<code>\\server\''user_name''\</code>パスを使用して、ユーザーのホームディレクトリを動的に共有する、Sambaのビルトインの<code>[homes]</code>セクションを使用しません。これは特定のシナリオでは役に立ちますが、いくつかの欠点があります。
* Windows does not support this feature, and certain settings, such as folder redirection in an Active Directory (AD), require a workaround instead and you cannot use the official solution.
* Windowsはこの機能をサポートしていません。また、Active Directory(AD)でのフォルダリダイレクトなどの特定の設定では代わりに回避策が必要になり、公式のソリューションを使用できません。
* You must create each new user's home directory manually.
* 新しい各ユーザーのホームディレクトリを手動で作成する必要があります。
* The <code>[homes]</code> feature is not supported running on a Samba Active Directory (AD) domain controller (DC).
* <code>[homes]</code>はActive Directory (AD) ドメインコントローラ(DC)上での実行はサポートされていません。


In the following, the directory containing the home folders are shared using the <code>users</code> share name. Each user's home directory is created as a subdirectory on the <code>\\server\users\</code> share, such as, <code>\\server\users\''user_name''</code>. This is the same format used in a Microsoft Windows environment and requires no additional work to set up.
以下では、ホームフォルダを含んでいるディレクトリは、共有名<code>users</code>を使用して共有されます。各ユーザーのホームディレクトリは、<code>\\server\users\''user_name''</code>のような感じで、<code>\\server\users\</code>共有のサブディレクトリとして作成されます。これはMicrosoft Windowsの環境で使われているのと同じフォーマットであり、追加の設定を要しません。


= Sambaファイルサーバーで共有を設定する =


== WindowsのACLを使う ==


ホームディレクトリをホストする共有に、拡張アクセスコントロールリスト(ACL)を設定することは、手動でユーザーのホームフォルダを作成、アクセス許可を設定することなしに、<code>Active Directory ユーザーとコンピュータ</code>に新しいユーザーを作成することを可能にします。


Sambaファイルサーバー上でユーザーのホームフォルダーをホストするための共有を作成するには、たとえば<code>users</code>を使用します:


= Setting up the Share on the Samba File Server =
* 新しい共有を作成してください。 詳細については、[[Windows ACLs を利用して共有を設定する]]を参照してください。 以下の権限を設定します:


== Using Windows ACLs ==
:* 共有の権限:
 
Setting extended access control lists (ACL) on the share that hosts home directories enables you to create new users in the <code>Active Directory Users and Computers</code> application without manually creating the user's home folder and setting permissions.
 
To create a share, for example, <code>users</code> for hosting the user home folders on a Samba file server:  
 
* Create a new share. For details, see [[Setting up a Share Using Windows ACLs]]. Set the following permissions:
 
:* Share permissions:
::{| class="wikitable"
::{| class="wikitable"
!Principal
!Principal
36行目: 32行目:
|}
|}


:* File system permissions on the root of the <code>users</code> share:
:* <code>users</code>共有のルートのファイルシステムのアクセス許可:


::{| class="wikitable"
::{| class="wikitable"
56行目: 52行目:
|}
|}


::<nowiki>*</nowiki> You can alternatively set other groups, to enable the group members to store their user profile on the share. When using different groups, apply the permissions as displayed for <code>Domain Users</code> in the previous example.
:: <nowiki>*</nowiki> グループのメンバーがユーザーのプロファイルをその共有に格納することを可能にするために、別のグループを設定することもできます。異なるグループを使用する場合は、前の例の<code>Domain Users</code>に表示されているように権限を適用してください。
 
:: Verify that permission inheritance is disabled on the root of the share. If any permission entry in the <code>Advanced Security Settings</code> window displays a path in the <code>Inherited from</code> column, click the <code>Disable inheritance</code> button. On Windows 7, unselect the <code>Include inheritable permissions from this object's parent</code> check box to set the same setting.
 
::[[Image:Home_Folder_File_System_ACLs.png]]


:: On a Samba share, you can omit the <code>SYSTEM</code> account in the file system ACLs. For details, see [[The SYSTEM Account]].
:: 共有のルートで権限の継承が無効になっていることを確認します。[<code>セキュリティの詳細設定</code>]ウィンドウの許可エントリに<code>継承元</code>列にパスが表示されている場合は、[<code>継承を無効にする</code>]ボタンをクリックします。 Windows 7では、<code>このオブジェクトの親からの継承可能なアクセス許可を含める</code>チェックボックスをオフにして、同じ設定を設定します。


These settings enable members of the <code>Domain Admins</code> group to set the user home folder in the <code>Active Directory Users and Computers</code> application, that automatically creates the home folder and sets the correct permissions.
:: [[Image:Home_Folder_File_System_ACLs.png]]


:: Samba共有では、ファイルシステムACLの<code>SYSTEM</code>アカウントを省略できます。詳細は、[[The SYSTEM Account]]を参照してください。


これらの設定により、<code>Domain Admins</code>グループのメンバーは、<code>Active Directoryユーザーとコンピュータ</code>アプリケーションでユーザーのホームフォルダを設定できます。これにより、ホームフォルダが自動的に作成され、正しいアクセス許可が設定されます。


== Using POSIX ACLs ==
== POSIX ACLを使用する ==


Instead of using Windows access control lists (ACL), you can set up a share using POSIX ACLs on your Samba server. However, when using POSIX ACL to set permissions, you must create the home directory for each new user manually and set permissions.
Windowsのアクセス制御リスト(ACL)を使用する代わりに、SambaサーバーでPOSIX ACLを使用して共有を設定できます。 ただし、POSIX ACLを使用して権限を設定する場合は、新しいユーザーごとにホームディレクトリを手動で作成し、権限を設定する必要があります。


{{Imbox
{{Imbox
| type = note
| type = notice
| text = When setting up the share on a Samba Active Directory (AD) domain controller (DC), you cannot use POSIX ACLs. On an Samba DC, only shares using extended ACLs are supported. For further details, see [[Setting_up_a_Share_Using_Windows_ACLs#Enable_Extended_ACL_Support_in_the_smb.conf_File|Enable Extended ACL Support in the smb.conf File]]. To set up the share on a Samba AD DC, see [[#Using_Windows_ACLs|Setting up the Home Folder Share on the Samba File Server - Using Windows ACLs]].
| style = margin: 4px 2%;
| text = Samba Active Directory(AD)ドメインコントローラ(DC)で共有を設定するときは、POSIX ACLを使用できません。 Samba DCでは、拡張ACLを使用した共有のみがサポートされています。 詳細については、[[Windows ACLs を利用して共有を設定する#smb.confファイルで拡張ACLサポートを有効にする | smb.confファイルで拡張ACLサポートを有効にする]]を参照してください。 Samba AD DCで共有を設定するには、[[#WindowsのACLを使う | Sambaファイルサーバーでホームフォルダー共有を設定する - Windows ACLの使用]]を参照してください。
}}
}}


For example, to create the <code>users</code> share:  
たとえば、<code>users</code>共有を作成するには:  


* Add the following share configuration section to your <code>smb.conf</code> file:
* <code>smb.conf</code>ファイルに次の共有設定セクションを追加します:


   [users]
   [users]
87行目: 82行目:
           force directory mode = 0700
           force directory mode = 0700


: For details about the parameters used, see the descriptions in the smb.conf(5) man page.
: 使用されるパラメータの詳細については、smb.conf(5) のマニュアルページの説明を参照してください。


: Do not use <code>homes</code> as name of the share. For further details, see [[#Introduction|Introduction]].
: 共有の名前として<code>homes</code>を使用しないでください。 詳細については、[[#はじめに | はじめに]]を参照してください。


* Create the directory and set the correct permissions:
* ディレクトリを作成し、正しい権限を設定してください:


  # mkdir -p /srv/samba/users/
  # mkdir -p /srv/samba/users/
97行目: 92行目:
  # chmod 2750 /srv/samba/users/
  # chmod 2750 /srv/samba/users/


: In a domain, the <code>Domain Users</code> group is a group, all domain user accounts are member of. Alternatively, or if you are running a non-domain environment, you can set it to any group that exists locally. However, user accounts must be member of this group to access the share.
: ドメインでは、<code> Domain Users </code>グループはグループで、すべてのドメインユーザーアカウントがそのメンバーです。 あるいは、ドメイン以外の環境を実行している場合は、ローカルに存在する任意のグループに設定できます。 ただし、共有にアクセスするには、ユーザーアカウントがこのグループのメンバーである必要があります。


* Reload Samba:
* Sambaをリロード:


  # smbcontrol all reload-config
  # smbcontrol all reload-config


= 新しいユーザのホームフォルダを作成する =


== Windows ACLを使用する ==


<code>Active Directoryユーザーとコンピュータ</code>アプリケーションを使用している場合は、ユーザーのホームディレクトリが自動的に作成され、アプリケーションでユーザーフォルダへのパスを設定すると正しいアクセス許可が適用されます。 <code> Active Directoryユーザーとコンピュータ</code>を使用していない場合は、フォルダを手動で作成して正しい権限を設定する必要があります。 例えば;


* <code>\\server\users\</code>共有に新しいフォルダを作成する権限を持つアカウントを使用してWindowsマシンにログインします。


= Creating the Home Folder for a New User =
* <code>\\server\users\</code>共有に移動します。
 
== Using Windows ACLs ==
 
If you are using the <code>Active Directory Users and Computers</code> application, the user's home directory is automatically created and the correct permissions applied when you set the path to the user folder in the application. If you are not using <code>Active Directory Users and Computers</code>, you must create the folder manually and set the correct permissions. For example:
 
* Log in to a Windows machine using an account that has permissions to create new folders on the <code>\\server\users\</code> share.
 
* Navigate to the <code>\\server\users\</code> share.


* Create a new home folder for the user.
* ユーザーの新しいホームフォルダを作成します。


* Add the user to the access control list (ACL) of the folder and grant <code>Full control</code> to the user. For details, see [[Setting_up_a_Share_Using_Windows_ACLs#Setting_ACLs_on_a_Folder|Setting ACLs on a Folder]].
* フォルダのアクセス制御リスト(ACL)にユーザを追加し、そのユーザに<code>フルコントロール</code>を付与します。 詳細については、[[Windows ACLs を利用して共有を設定する#フォルダにACLを設定する |フォルダへのACLの設定]]を参照してください。


== POSIX ACLを使用する ==


POSIXアクセスコントロールリスト(ACL)を使用して<code>users</code>共有を設定するときは、新しいユーザーごとにホームフォルダを手動で作成する必要があります。 <code>demo</code>ユーザーのホームフォルダを作成するには:


== Using POSIX ACLs ==
* ディレクトリを作成:
 
When you set up the <code>users</code> share using POSIX access control lists (ACL), you must create the home folder for each new user manually. To create the home folder for the <code>demo</code> user:
 
* Create the directory:


  # mkdir /srv/samba/users/demo/
  # mkdir /srv/samba/users/demo/


* Set the following permissions to only enable the <code>demo</code> user to access the directory:
* 次の権限を設定して、<code>demo</code>ユーザーのみがディレクトリにアクセスできるようにします:


  # chown ''user_name'' /srv/samba/users/demo/
  # chown ''user_name'' /srv/samba/users/demo/
  # chmod 700 /srv/samba/users/demo/
  # chmod 700 /srv/samba/users/demo/


= ホームフォルダをユーザに割り当てる =


== Active Directoryの場合 ==


=== <code>Active Directoryユーザーとコンピュータ</code>(ADUC)を使用する ===


Active Directoryでは、<code>Active Directoryユーザーとコンピュータ</code> Windowsアプリケーションを使用して、ユーザーのホームフォルダへのパスと割り当てられたドライブ文字を設定できます。 リモートサーバー管理ツール(RSAT)がインストールされていない場合は、[[RSATのインストール| RSATのインストール]]を参照してください。


= Assigning a Home Folder to a User =
<code>\\server\users\demo\</code>パスをホームフォルダとして<code>demo</code>アカウントに割り当てるには:


== In an Active Directory ==
* ユーザーアカウントを編集できるアカウントを使用してコンピューターにログインします。


=== Using <code>Active Directory Users and Computers</code> ===
* <code>Active Directoryユーザーとコンピュータ</code>アプリケーションを開きます。


In an Active Directory, you can use the <code>Active Directory Users and Computers</code> Windows application to set the path to the user home folder and the assigned drive letter. If you do not have the Remote Server Administration Tools (RSAT) installed, see [[Installing RSAT|Installing RSAT]].
* <code>demo</code>アカウントを含むディレクトリコンテナに移動します。


To assign the <code>\\server\users\demo\</code> path as home folder to the <code>demo</code> account:
* <code>demo</code>ユーザーアカウントを右クリックして、<code>プロパティ</code>を選択します。


* Log in to a computer using an account that is able to edit user accounts.
* [<code>プロフィール</code>]タブをクリックします。


* Open the <code>Active Directory Users and Computers</code> application.
* [<code>Connect</code>]を選択します。Windowsがマップされたホームフォルダを割り当て、<code>To</code>フィールドにホームフォルダへのパスを入力します。
 
* Navigate to the directory container that contains the <code>demo</code> account.
 
* Right-click to the <code>demo</code> user account and select <code>Properties</code>.
 
* Select the <code>Profile</code> tab.
 
* Select <code>Connect</code>, the drive letter Windows assigns the mapped home folder to, and enter the path to the home folder into the <code>To</code> field.


:[[Image:ADUC_Set_Home_Folder.png]].
:[[Image:ADUC_Set_Home_Folder.png]].


* Click <code>OK</code>.
* <code>OK</code>をクリック


If a warning is displayed when saving the settings that the home folder was not created:
ホームフォルダが作成されていないという設定を保存するときに警告が表示された場合:
* the permissions on the <code>users</code> share were incorrectly set when you set up the share using Windows access control lists (ACL). To fix the problem, set the permissions described in [[#Using_Windows_ACLs|Using Windows ACLs]].
* Windowsのアクセス制御リスト(ACL)を使用して共有を設定すると、<code>users</code>共有のアクセス許可が正しく設定されませんでした。 この問題を解決するには、[[#Windows_ACLを使用する | Windows ACLの使用]]で説明されている権限を設定します。
* you set up the share using POSIX ACL. To fix the problem, create the directory manually. See [[#Using_POSIX_ACLs_2|Creating the Home Folder for a New User - Using POSIX ACLs]].
* あなたはPOSIX ACLを使って共有を設定した。 問題を解決するには、ディレクトリを手動で作成してください。 [[#POSIX_ACLを使用する |新規ユーザーのホームフォルダーの作成 - POSIX ACLの使用]]を参照してください。


=== グループポリシー設定を使用する ===


グループポリシー設定を使用して、設定を組織単位(OU)またはドメインに割り当てることができます。これにより、たとえば、OUまたはドメイン内のすべてのユーザーにホームフォルダパスを自動的に割り当てることができます。アカウントを別のOUまたはドメインに移動すると、設定は削除または更新されます。 この方法を使用すると、各ユーザーアカウントに手動で設定を割り当てる必要はありません。


=== Using a Group Policy Preference ===
各ユーザーのホームフォルダーとして<code>\\server\users\''user_name''</code>パスを自動的に割り当てるドメインのグループポリシーオブジェクト(GPO)を作成するには、次の手順を実行します。


Using group policy preferences, you can assign settings to organizational units (OU) or to a domain. This enables you, for example, to automatically assign home folder paths to all users in the OU or domain. If you move the account to a different OU or domain, the setting is removed or updated. Using this way, you do not have to assign manually the setting to each user account.
* ADドメインの<code>Administrator</code>アカウントなど、グループポリシーを編集できるアカウントを使用してコンピュータにログインします。


To create a group policy object (GPO) for the domain that automatically assigns the <code>\\server\users\''user_name''</code> path as home folder to each user:
* <code>グループポリシー管理コンソール</code>を開きます。 このコンピュータにリモートサーバー管理ツール(RSAT)がインストールされていない場合は、[[RSATのインストール| RSATのインストール]]を参照してください。


* Log in to a computer using an account that is allowed you to edit group policies, such as the AD domain <code>Administrator</code> account.
* 自分のADドメインを右クリックして[<code>このドメインにGPOを作成し、ここにリンク</code>]を選択します。
 
* Open the <code>Group Policy Management Console</code>. If you are not having the Remote Server Administration Tools (RSAT) installed on this computer, see [[Installing RSAT|Installing RSAT]].
 
* Right-click to your AD domain and select <code>Create a GPO in this domain, and Link it here</code>.


:[[Image:GPMC_Create_GPO.png]]
:[[Image:GPMC_Create_GPO.png]]


* Enter a name for the GPO, such as <code>Home folders on ''server''</code>. The new GPO is shown below the domain entry.
* <code>Home Folders on ''server''</code>のようにGPOの名前を入力します。 新しいGPOがドメインエントリの下に表示されます。


* Right-click to the newly-created GPO and select <code>Edit</code> to open the <code>Group Policy Management Editor</code>.
* 新しく作成したGPOを右クリックして[<code>編集</code>]を選択し、<code>グループポリシー管理エディタ</code>を開きます。


* Navigate to the <code>User Configuration</code> &rarr; <code>Preferences</code> &rarr; <code>Windows Settings</code> &rarr; <code>Drive Maps</code> entry.
* <code>ユーザー設定</code>&rarr;に移動します。 <code>設定</code>&rarr; <code> Windowsの設定</code>&rarr; <code>ドライブマップ</code>エントリ


* Right-click to the <code>Drive Maps</code> entry and select <code>New</code> &rarr; <code>Mapped Drive</code>.
* [<code>ドライブマップ</code>]エントリを右クリックして[<code>新規</code>]を選択し、&rarr; <code>割り当てられたドライブ</code>


* Set the following:
*以下を設定してください。
:* On the <code>General</code> tab:
:* <code>General</code>タブで:
::* Action: <code>Create</code>
::* アクション:<code>作成</code>
::* Location: <code>\\server\users\%LogonUser%</code>
::* 場所:<code>\\server\users\%LogonUser%</code>
::: Windows automatically replaces the <code>%LogonUser%</code> variable when a user logs in
::: ユーザーがログインすると、Windowsは<code>%LogonUser%</code>変数を自動的に置き換えます
::* Select <code>Reconnect</code>
::* <code>再接続</code>を選択
::* Label: Enter a string. For example: <code>Home</code>
::* ラベル:文字列を入力してください。 たとえば、<code> Home </code>
::* Use: Select a drive letter the home folder is mapped to.
::* 使用:ホームフォルダが割り当てられているドライブ文字を選択します。
:* On the <code>Common</code> tab:
:* <code> Common </code>タブで:
::* Select <code>Run in logged-on user's security context (user policy option)</code>
::* <code>ログオンしたユーザーのセキュリティコンテキストで実行する(ユーザーポリシーオプション)</code>を選択します。


:[[Image:GPME_Home_Drive_Properties.png]]
:[[Image:GPME_Home_Drive_Properties.png]]


:* Click <code>OK</code>.
:* <code>OK</code>をクリック


* Close the <code>Group Policy Management Editor</code>. The GPOs are automatically saved on the <code>Sysvol</code> share on the domain controller (DC).
* <code>グループポリシー管理エディタ</code>を閉じます。GPOは自動的にドメインコントローラ(DC)の<code>Sysvol</code>共有に保存されます。


* Close the <code>Group Policy Management Console</code>.
* <code>グループポリシー管理コンソール</code>を閉じます。


The policy is applied to users in the OU or domain, the policy is assigned to, during the next log in.
ポリシーはOUあるいはドメインのユーザーに適用され、ポリシーは次回のログオン時に割り当てられます。


=== ドメインコントローラで<code>ldbedit</code>を使用する ===


ドメインコントローラ(DC)上で、例えば、<code>demo</code>アカウントに対してホームフォルダーとして<code>\\server\users\demo</code>パスを割り当て、かつ割り当てたドライブレターに<code>H:</code>をセットするには:


=== Using <code>ldbedit</code> on a Domain Controller ===
* <code>demo</code>アカウントを編集:
 
On a domain controller (DC), for example, to assign the <code>\\server\users\demo</code> path as home folder to the <code>demo</code> account and set the assigned drive letter to <code>H:</code>
 
* Edit the <code>demo</code>user account:


  # ldbedit -H /usr/local/samba/private/sam.ldb 'sAMAccountName=demo'
  # ldbedit -H /usr/local/samba/private/sam.ldb 'sAMAccountName=demo'


* The accounts attributes are displayed in an editor. Append the following attributes and values to the end of the list:
* アカウントの属性がエディタで表示されます。以下の属性と値を一覧の最後に追加してください:


  homeDrive: H:
  homeDrive: H:
  homeDirectory: \\server\users\demo\
  homeDirectory: \\server\users\demo\


* Save the changes.
* 変更を保存します。


The setting is applied the next time the user logs in.
設定は、次回そのユーザーがログインする際に適用されます。


== NT4ドメインで ==


NT4ドメインで、ホームフォルダーのパスとして<code>\\server\users\%U</code>をセットし、ドライブレターが<code>H:</code>のドライブにマップするには:


== In an NT4 Domain ==
* 以下のパラメータを<conf>smb.conf</conf>ファイルの<code>[global]</code>セクションに追加します:
 
In an Samba NT4 domain, to set <code>\\server\users\%U</code> as path to the home folder and to map the drive to the <code>H:</code> drive letter:
 
* Add the following parameters to the <code>[global]</code> section in your <code>smb.conf</code> file:


  logon drive = H:
  logon drive = H:
  logon home = \\server\users\%U
  logon home = \\server\users\%U


: During logging in to the domain member, Samba automatically replaces the <code>%U</code> variable with the session user name. For further details, see the <code>Variable Substitutions</code> section in the <code>smb.conf(5)</code> man page.
: ドメインメンバーがログインする際に、Sambaは変数<code>%U</code>をセッションユーザ名で自動的に置き換えます。詳細については、<code>smb.conf(5)</code>のマニュアルページの<code>Variable Substitutions</code>セクションを参照してください。


* Reload Samba:
* Sambaをリロード:


  # smbcontrol all reload-config
  # smbcontrol all reload-config


== 非ドメイン環境 ==


=== Windows Professional あるいは上位のエディション ===


== In a Non-domain Environment ==
Sambaサーバとクライアントがドメインの一部でない場合、ローカルユーザーアカウントのプロパティにユーザーホームフォルダーのマッピングを設定してください:
 
=== Using a Windows Professional or Higher Edition ===


If your Samba server and clients are not part of a domain, set the user home folder mapping in the local user account's properties:
* ローカルの<code>Administrators</code>グループに属しているアカウントを使用して、Windowsマシンにログオンしてください。


* Log on to the Windows machine using an account that is member of the local <code>Administrators</code> group.
* <code>lusrmgr.msc</code>(ローカルユーザーとグループ)を開いてください。
: Windows Home editionでは、<code>lusrmgr.msc</code>は利用できません。


* Open the <code>lusrmgr.msc</code> (Local User and Groups) application.
: The <code>lusrmgr.msc</code> application is not available in Windows Home editions.


* Click <code>Users</code> in the navigation on the left side.
* 左側のナビゲーションで、<code>ユーザー</code>をクリックします。


* Right-click the account you want to assign a home folder to, and select <code>Properties</code>
* ホームフォルダーを割り当てたいアカウントを右クリックし、<code>プロパティ</code>を選択します。


* Navigate to the <code>Profile</code> tab.
* <code>プロファイル</code>タブに移動します。


* Select <code>Connect</code>, the drive letter Windows assigns the mapped home folder to, and enter the path to the home folder into the <code>To</code> field.
* <code>接続ドライブ</code>を選択し、マップされたホームフォルダにドライブレターを割り当て、<code>パス</code>フィールドにホームフォルダのパスを入力してください。


* Click <code>OK</code>.
* <code>OK</code>をクリックします。


You must set the mapping for each user on every Windows client manually.
全てのWindowsクライアントのそれぞれのユーザーに手動でマッピングを設定する必要があります。






=== Using Windows Home Edition ===
=== Windows Home Editionを使用 ===


Windows Home editions do not provide the necessary application to set the user home folder mapping in the local account properties. Instead each user must map the drive manually:
Windows Homeエディションは、ローカルアカウントのプロパティでユーザーのホームフォルダーのマッピングを設定するために必要なアプリケーションを提供しません。 代わりに、各ユーザーが手動でドライブを割り当てる必要があります:


* Log on to the Windows machine as the user that should get the home folder mapped
*ホームフォルダをマッピングする必要があるユーザーとしてWindowsマシンにログオンします。


* Open a command prompt.
*コマンドプロンプトを開きます。


* For example, to map the <code>\\server\users\demo\</code> folder to the <code>H:</code> drive letter, enter:
*たとえば、<code>\\server\users\demo\</code>フォルダを<code>H:</code>ドライブ文字にマップするには、次のように入力します。


  > net use H: \\server\users\demo\ /persistent:yes
  > net use H: \\server\users\demo\ /persistent:yes


The user home folder is automatically connected when the user logs in. To stop the automatic mapping, disconnect the drive. For example:
ユーザーがログインすると、ユーザーのホームフォルダが自動的に接続されます。自動マッピングを停止するには、ドライブを取り外します。 例えば:


  > net use H: /delete
  > net use H: /delete

2019年3月3日 (日) 01:07時点における最新版

はじめに

ホームフォルダには、個々のアカウントのファイルが含まれています。Sambaを使用すると、ネットワークユーザーが自分のファイルを、ファイルサーバー上の自分のホームフォルダーに保存できるように、ディレクトリを共有できます。

このドキュメントでは、\\server\user_name\パスを使用して、ユーザーのホームディレクトリを動的に共有する、Sambaのビルトインの[homes]セクションを使用しません。これは特定のシナリオでは役に立ちますが、いくつかの欠点があります。

  • Windowsはこの機能をサポートしていません。また、Active Directory(AD)でのフォルダリダイレクトなどの特定の設定では代わりに回避策が必要になり、公式のソリューションを使用できません。
  • 新しい各ユーザーのホームディレクトリを手動で作成する必要があります。
  • [homes]はActive Directory (AD) ドメインコントローラ(DC)上での実行はサポートされていません。

以下では、ホームフォルダを含んでいるディレクトリは、共有名usersを使用して共有されます。各ユーザーのホームディレクトリは、\\server\users\user_nameのような感じで、\\server\users\共有のサブディレクトリとして作成されます。これはMicrosoft Windowsの環境で使われているのと同じフォーマットであり、追加の設定を要しません。

Sambaファイルサーバーで共有を設定する

WindowsのACLを使う

ホームディレクトリをホストする共有に、拡張アクセスコントロールリスト(ACL)を設定することは、手動でユーザーのホームフォルダを作成、アクセス許可を設定することなしに、Active Directory ユーザーとコンピュータに新しいユーザーを作成することを可能にします。

Sambaファイルサーバー上でユーザーのホームフォルダーをホストするための共有を作成するには、たとえばusersを使用します:

  • 共有の権限:
Principal Access
Domain Users Change
Domain Admins Full Control
  • users共有のルートのファイルシステムのアクセス許可:
Principal Access Applies to
Domain Users* Read & execute This folder only
CREATOR OWNER Full control Subfolders and files only
Domain Admins Full control This folder, subfolders and files
* グループのメンバーがユーザーのプロファイルをその共有に格納することを可能にするために、別のグループを設定することもできます。異なるグループを使用する場合は、前の例のDomain Usersに表示されているように権限を適用してください。
共有のルートで権限の継承が無効になっていることを確認します。[セキュリティの詳細設定]ウィンドウの許可エントリに継承元列にパスが表示されている場合は、[継承を無効にする]ボタンをクリックします。 Windows 7では、このオブジェクトの親からの継承可能なアクセス許可を含めるチェックボックスをオフにして、同じ設定を設定します。
Samba共有では、ファイルシステムACLのSYSTEMアカウントを省略できます。詳細は、The SYSTEM Accountを参照してください。

これらの設定により、Domain Adminsグループのメンバーは、Active Directoryユーザーとコンピュータアプリケーションでユーザーのホームフォルダを設定できます。これにより、ホームフォルダが自動的に作成され、正しいアクセス許可が設定されます。

POSIX ACLを使用する

Windowsのアクセス制御リスト(ACL)を使用する代わりに、SambaサーバーでPOSIX ACLを使用して共有を設定できます。 ただし、POSIX ACLを使用して権限を設定する場合は、新しいユーザーごとにホームディレクトリを手動で作成し、権限を設定する必要があります。

{{#invoke:Message box|imbox}}

たとえば、users共有を作成するには:

  • smb.confファイルに次の共有設定セクションを追加します:
 [users]
         path = /srv/samba/users/
         read only = no
         force create mode = 0600
         force directory mode = 0700
使用されるパラメータの詳細については、smb.conf(5) のマニュアルページの説明を参照してください。
共有の名前としてhomesを使用しないでください。 詳細については、 はじめにを参照してください。
  • ディレクトリを作成し、正しい権限を設定してください:
# mkdir -p /srv/samba/users/
# chgrp -R "Domain Users" /srv/samba/users/
# chmod 2750 /srv/samba/users/
ドメインでは、 Domain Users グループはグループで、すべてのドメインユーザーアカウントがそのメンバーです。 あるいは、ドメイン以外の環境を実行している場合は、ローカルに存在する任意のグループに設定できます。 ただし、共有にアクセスするには、ユーザーアカウントがこのグループのメンバーである必要があります。
  • Sambaをリロード:
# smbcontrol all reload-config

新しいユーザのホームフォルダを作成する

Windows ACLを使用する

Active Directoryユーザーとコンピュータアプリケーションを使用している場合は、ユーザーのホームディレクトリが自動的に作成され、アプリケーションでユーザーフォルダへのパスを設定すると正しいアクセス許可が適用されます。 Active Directoryユーザーとコンピュータを使用していない場合は、フォルダを手動で作成して正しい権限を設定する必要があります。 例えば;

  • \\server\users\共有に新しいフォルダを作成する権限を持つアカウントを使用してWindowsマシンにログインします。
  • \\server\users\共有に移動します。
  • ユーザーの新しいホームフォルダを作成します。
  • フォルダのアクセス制御リスト(ACL)にユーザを追加し、そのユーザにフルコントロールを付与します。 詳細については、フォルダへのACLの設定を参照してください。

POSIX ACLを使用する

POSIXアクセスコントロールリスト(ACL)を使用してusers共有を設定するときは、新しいユーザーごとにホームフォルダを手動で作成する必要があります。 demoユーザーのホームフォルダを作成するには:

  • ディレクトリを作成:
# mkdir /srv/samba/users/demo/
  • 次の権限を設定して、demoユーザーのみがディレクトリにアクセスできるようにします:
# chown user_name /srv/samba/users/demo/
# chmod 700 /srv/samba/users/demo/

ホームフォルダをユーザに割り当てる

Active Directoryの場合

Active Directoryユーザーとコンピュータ(ADUC)を使用する

Active Directoryでは、Active Directoryユーザーとコンピュータ Windowsアプリケーションを使用して、ユーザーのホームフォルダへのパスと割り当てられたドライブ文字を設定できます。 リモートサーバー管理ツール(RSAT)がインストールされていない場合は、 RSATのインストールを参照してください。

\\server\users\demo\パスをホームフォルダとしてdemoアカウントに割り当てるには:

  • ユーザーアカウントを編集できるアカウントを使用してコンピューターにログインします。
  • Active Directoryユーザーとコンピュータアプリケーションを開きます。
  • demoアカウントを含むディレクトリコンテナに移動します。
  • demoユーザーアカウントを右クリックして、プロパティを選択します。
  • [プロフィール]タブをクリックします。
  • [Connect]を選択します。Windowsがマップされたホームフォルダを割り当て、Toフィールドにホームフォルダへのパスを入力します。
.
  • OKをクリック

ホームフォルダが作成されていないという設定を保存するときに警告が表示された場合:

  • Windowsのアクセス制御リスト(ACL)を使用して共有を設定すると、users共有のアクセス許可が正しく設定されませんでした。 この問題を解決するには、 Windows ACLの使用で説明されている権限を設定します。
  • あなたはPOSIX ACLを使って共有を設定した。 問題を解決するには、ディレクトリを手動で作成してください。 新規ユーザーのホームフォルダーの作成 - POSIX ACLの使用を参照してください。

グループポリシー設定を使用する

グループポリシー設定を使用して、設定を組織単位(OU)またはドメインに割り当てることができます。これにより、たとえば、OUまたはドメイン内のすべてのユーザーにホームフォルダパスを自動的に割り当てることができます。アカウントを別のOUまたはドメインに移動すると、設定は削除または更新されます。 この方法を使用すると、各ユーザーアカウントに手動で設定を割り当てる必要はありません。

各ユーザーのホームフォルダーとして\\server\users\user_nameパスを自動的に割り当てるドメインのグループポリシーオブジェクト(GPO)を作成するには、次の手順を実行します。

  • ADドメインのAdministratorアカウントなど、グループポリシーを編集できるアカウントを使用してコンピュータにログインします。
  • グループポリシー管理コンソールを開きます。 このコンピュータにリモートサーバー管理ツール(RSAT)がインストールされていない場合は、 RSATのインストールを参照してください。
  • 自分のADドメインを右クリックして[このドメインにGPOを作成し、ここにリンク]を選択します。
  • Home Folders on serverのようにGPOの名前を入力します。 新しいGPOがドメインエントリの下に表示されます。
  • 新しく作成したGPOを右クリックして[編集]を選択し、グループポリシー管理エディタを開きます。
  • ユーザー設定→に移動します。 設定 Windowsの設定ドライブマップエントリ
  • [ドライブマップ]エントリを右クリックして[新規]を選択し、→ 割り当てられたドライブ
  • 以下を設定してください。
  • Generalタブで:
  • アクション:作成
  • 場所:\\server\users\%LogonUser%
ユーザーがログインすると、Windowsは%LogonUser%変数を自動的に置き換えます
  • 再接続を選択
  • ラベル:文字列を入力してください。 たとえば、 Home
  • 使用:ホームフォルダが割り当てられているドライブ文字を選択します。
  • Common タブで:
  • ログオンしたユーザーのセキュリティコンテキストで実行する(ユーザーポリシーオプション)を選択します。
  • OKをクリック
  • グループポリシー管理エディタを閉じます。GPOは自動的にドメインコントローラ(DC)のSysvol共有に保存されます。
  • グループポリシー管理コンソールを閉じます。

ポリシーはOUあるいはドメインのユーザーに適用され、ポリシーは次回のログオン時に割り当てられます。

ドメインコントローラでldbeditを使用する

ドメインコントローラ(DC)上で、例えば、demoアカウントに対してホームフォルダーとして\\server\users\demoパスを割り当て、かつ割り当てたドライブレターにH:をセットするには:

  • demoアカウントを編集:
# ldbedit -H /usr/local/samba/private/sam.ldb 'sAMAccountName=demo'
  • アカウントの属性がエディタで表示されます。以下の属性と値を一覧の最後に追加してください:
homeDrive: H:
homeDirectory: \\server\users\demo\
  • 変更を保存します。

設定は、次回そのユーザーがログインする際に適用されます。

NT4ドメインで

NT4ドメインで、ホームフォルダーのパスとして\\server\users\%Uをセットし、ドライブレターがH:のドライブにマップするには:

  • 以下のパラメータを<conf>smb.conf</conf>ファイルの[global]セクションに追加します:
logon drive = H:
logon home = \\server\users\%U
ドメインメンバーがログインする際に、Sambaは変数%Uをセッションユーザ名で自動的に置き換えます。詳細については、smb.conf(5)のマニュアルページのVariable Substitutionsセクションを参照してください。
  • Sambaをリロード:
# smbcontrol all reload-config

非ドメイン環境

Windows Professional あるいは上位のエディション

Sambaサーバとクライアントがドメインの一部でない場合、ローカルユーザーアカウントのプロパティにユーザーホームフォルダーのマッピングを設定してください:

  • ローカルのAdministratorsグループに属しているアカウントを使用して、Windowsマシンにログオンしてください。
  • lusrmgr.msc(ローカルユーザーとグループ)を開いてください。
Windows Home editionでは、lusrmgr.mscは利用できません。


  • 左側のナビゲーションで、ユーザーをクリックします。
  • ホームフォルダーを割り当てたいアカウントを右クリックし、プロパティを選択します。
  • プロファイルタブに移動します。
  • 接続ドライブを選択し、マップされたホームフォルダにドライブレターを割り当て、パスフィールドにホームフォルダのパスを入力してください。
  • OKをクリックします。

全てのWindowsクライアントのそれぞれのユーザーに手動でマッピングを設定する必要があります。


Windows Home Editionを使用

Windows Homeエディションは、ローカルアカウントのプロパティでユーザーのホームフォルダーのマッピングを設定するために必要なアプリケーションを提供しません。 代わりに、各ユーザーが手動でドライブを割り当てる必要があります:

  • ホームフォルダをマッピングする必要があるユーザーとしてWindowsマシンにログオンします。
  • コマンドプロンプトを開きます。
  • たとえば、\\server\users\demo\フォルダをH:ドライブ文字にマップするには、次のように入力します。
> net use H: \\server\users\demo\ /persistent:yes

ユーザーがログインすると、ユーザーのホームフォルダが自動的に接続されます。自動マッピングを停止するには、ドライブを取り外します。 例えば:

> net use H: /delete