Red Hat Training

A Red Hat training course is available for RHEL 8

35.7. IdM クライアントで IdM ユーザーのホームディレクトリーをオーバーライドする ID ビューの追加

Identity Management (IdM) の ID ビューは、特定の IdM ユーザーに関連する POSIX 属性値をオーバーライドします。この手順では、host1 という名前の IdM クライアントの idm_user に適用される ID ビューを作成し、ユーザーが /home/idm_user/ ではなく、ユーザーホームディレクトリーとして /home/user_1234/ ディレクトリーを使用できるようにします。

前提条件

  • host1.idm.example.com への root アクセス権限がある。
  • admin などの必要な権限を持つユーザーとしてログインしている。

手順

  1. root で、idm_user がユーザーのホームディレクトリーとして host1.idm.example.com で使用するディレクトリーを作成します。

    [root@host1 /]# mkdir /home/user_1234/
  2. ディレクトリーの所有権を変更します。

    [root@host1 /]# chown idm_user:idm_user /home/user_1234/
  3. ID ビューを作成します。たとえば、example_for_host1 という名前の ID ビューを作成するには、次のコマンドを実行します。

    $ ipa idview-add example_for_host1
    ---------------------------
    Added ID View "example_for_host1"
    ---------------------------
      ID View Name: example_for_host1
  4. ユーザーの上書きを example_for_host1 ID ビューに追加します。ユーザーのホームディレクトリーをオーバーライドするには、次のコマンドを実行します。

    • ipa idoverrideuser-add コマンドを入力します。
    • ID ビューの名前を追加します。
    • ユーザー名 (アンカーとも呼ばれます) を追加します。
    • --homedir オプションを追加します。
    $ ipa idoverrideuser-add example_for_host1 idm_user --homedir=/home/user_1234
    -----------------------------
    Added User ID override "idm_user"
    -----------------------------
      Anchor to override: idm_user
      Home directory: /home/user_1234/
  5. example_for_host1host1.idm.example.com ホストに適用します。

    $ ipa idview-apply example_for_host1 --hosts=host1.idm.example.com
    -----------------------------
    Applied ID View "example_for_host1"
    -----------------------------
    hosts: host1.idm.example.com
    ---------------------------------------------
    Number of hosts the ID View was applied to: 1
    ---------------------------------------------
    注記

    ipa idview-apply コマンドでは、--hostgroups オプションも使用できます。このオプションは、ID ビューを、指定のホストグループに所属するホストに適用しますが、ホストグループ自体との関連付けは行いません。代わりに、--hostgroups オプションは指定されたホストグループのメンバーを拡張して、--hosts オプションを個別にすべて適用します。

    つまり、今後ホストがホストグループに追加されても、ID ビューは新しいホストには適用されません。

  6. 新しい設定を host1.idm.example.com システムに適用するには、次のコマンドを実行します。

    1. root でシステムに対して SSH 接続します。

      $ ssh root@host1
      Password:
    2. SSSD キャッシュを削除します。

      root@host1 ~]# sss_cache -E
    3. SSSD デーモンを再起動します。
    root@host1 ~]# systemctl restart sssd

検証手順

  1. idm_user として host1SSH 接続します。

    [root@r8server ~]# ssh idm_user@host1.idm.example.com
    Password:
    Activate the web console with: systemctl enable --now cockpit.socket
    
    Last login: Sun Jun 21 22:34:25 2020 from 192.168.122.229
    [idm_user@host1 /]$
  2. 作業ディレクトリーを出力します。

    [idm_user@host1 /]$ pwd
    /home/user_1234/