3.5. Adding a new user automatically mapped to the SELinux unconfined_u user
The following procedure demonstrates how to add a new Linux user to the system. The user is automatically mapped to the SELinux unconfined_u user.
Prerequisites
-
The
rootuser is running unconfined, as it does by default in Red Hat Enterprise Linux.
Procedure
Enter the following command to create a new Linux user named
<example_user>:# useradd <example_user>To assign a password to the Linux
<example_user>user:# passwd <example_user> Changing password for user <example_user>. New password: Retype new password: passwd: all authentication tokens updated successfully.- Log out of your current session.
-
Log in as the Linux
<example_user>user. When you log in, thepam_selinuxPAM module automatically maps the Linux user to an SELinux user (in this case,unconfined_u), and sets up the resulting SELinux context. The Linux user’s shell is then launched with this context.
Verification
When logged in as the
<example_user>user, check the context of a Linux user:$ id -Z unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023