3.5. SELinux の unconfined_u ユーザーに自動的にマッピングされる新規ユーザーの追加

以下の手順では、新しい Linux ユーザーをシステムに追加する方法を説明します。ユーザーは自動的に SELinux unconfined_u ユーザーにマッピングされます。

前提条件

  • root ユーザーは、Red Hat Enterprise Linux でデフォルトで実行されるように、制限なしで実行されています。

手順

  1. 次のコマンドを入力して、<example_user> という名前の新しい Linux ユーザーを作成します。

    useradd <example_user>
  2. Linux の <example_user> ユーザーにパスワードを割り当てるには、次のコマンドを実行します。

    passwd <example_user>
    Changing password for user <example_user>.
    New password:
    Retype new password:
    passwd: all authentication tokens updated successfully.
  3. 現在のセッションからログアウトします。
  4. Linux の <example_user> ユーザーとしてログインします。ログインすると、PAM モジュール pam_selinux は Linux ユーザーを SELinux ユーザー (この場合は unconfined_u) に自動的にマッピングし、作成された SELinux コンテキストを設定します。Linux ユーザーのシェルはこのコンテキストで起動します。

検証

  1. <example_user> ユーザーとしてログインしたら、Linux ユーザーのコンテキストを確認します。

    $ id -Z
    unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

関連情報

  • pam_selinux(8) の man ページ