3.6. 新規ユーザーを SELinux で制限されたユーザーとして追加する
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