3.6. 新規ユーザーを SELinux で制限されたユーザーとして追加する
SELinux で制限された新しいユーザーをシステムに追加するには、ユーザーアカウントを作成する際に使用したコマンドと同じコマンドを使用できます。ユーザーを staff_u などの制限付きユーザーにマッピングすることで、システムを潜在的なセキュリティー侵害から保護することができます。
前提条件
-
rootユーザーは、Red Hat Enterprise Linux のデフォルト設定と同様に、制限なしで実行されています。
手順
次のコマンドを入力して、
<example_user>という名前の新しい Linux ユーザーを作成し、それを SELinuxstaff_uユーザーにマッピングします。# useradd -Z staff_u <example_user>Linux の
<example_user>ユーザーにパスワードを割り当てるには、次のコマンドを実行します。# passwd <example_user> Changing password for user <example_user>. New password: Retype new password: passwd: all authentication tokens updated successfully.- 現在のセッションからログアウトします。
-
Linux の
<example_user>ユーザーとしてログインします。ユーザーのシェルはstaff_uコンテキストで起動します。
検証
<example_user>ユーザーとしてログインしたら、Linux ユーザーのコンテキストを確認します。$ id -Z uid=1000(<example_user>) gid=1000(<example_user>) groups=1000(<example_user>) context=staff_u:staff_r:staff_t:s0-s0:c0.c1023