16cd6a6acSopenharmony_ciUser Statements
26cd6a6acSopenharmony_ci===============
36cd6a6acSopenharmony_ci
46cd6a6acSopenharmony_ciuser
56cd6a6acSopenharmony_ci----
66cd6a6acSopenharmony_ci
76cd6a6acSopenharmony_ciDeclares an SELinux user identifier in the current namespace.
86cd6a6acSopenharmony_ci
96cd6a6acSopenharmony_ci**Statement definition:**
106cd6a6acSopenharmony_ci
116cd6a6acSopenharmony_ci```secil
126cd6a6acSopenharmony_ci    (user user_id)
136cd6a6acSopenharmony_ci```
146cd6a6acSopenharmony_ci
156cd6a6acSopenharmony_ci**Where:**
166cd6a6acSopenharmony_ci
176cd6a6acSopenharmony_ci<table>
186cd6a6acSopenharmony_ci<colgroup>
196cd6a6acSopenharmony_ci<col width="25%" />
206cd6a6acSopenharmony_ci<col width="75%" />
216cd6a6acSopenharmony_ci</colgroup>
226cd6a6acSopenharmony_ci<tbody>
236cd6a6acSopenharmony_ci<tr class="odd">
246cd6a6acSopenharmony_ci<td align="left"><p><code>user</code></p></td>
256cd6a6acSopenharmony_ci<td align="left"><p>The <code>user</code> keyword.</p></td>
266cd6a6acSopenharmony_ci</tr>
276cd6a6acSopenharmony_ci<tr class="even">
286cd6a6acSopenharmony_ci<td align="left"><p><code>user_id</code></p></td>
296cd6a6acSopenharmony_ci<td align="left"><p>The SELinux <code>user</code> identifier.</p></td>
306cd6a6acSopenharmony_ci</tr>
316cd6a6acSopenharmony_ci</tbody>
326cd6a6acSopenharmony_ci</table>
336cd6a6acSopenharmony_ci
346cd6a6acSopenharmony_ci**Example:**
356cd6a6acSopenharmony_ci
366cd6a6acSopenharmony_ciThis will declare an SELinux user as `unconfined.user`:
376cd6a6acSopenharmony_ci
386cd6a6acSopenharmony_ci```secil
396cd6a6acSopenharmony_ci    (block unconfined
406cd6a6acSopenharmony_ci        (user user)
416cd6a6acSopenharmony_ci    )
426cd6a6acSopenharmony_ci```
436cd6a6acSopenharmony_ci
446cd6a6acSopenharmony_ciuserrole
456cd6a6acSopenharmony_ci--------
466cd6a6acSopenharmony_ci
476cd6a6acSopenharmony_ciAssociates a previously declared [`user`](cil_user_statements.md#user) identifier with a previously declared [`role`](cil_role_statements.md#role) identifier.
486cd6a6acSopenharmony_ci
496cd6a6acSopenharmony_ci**Statement definition:**
506cd6a6acSopenharmony_ci
516cd6a6acSopenharmony_ci```secil
526cd6a6acSopenharmony_ci    (userrole user_id role_id)
536cd6a6acSopenharmony_ci```
546cd6a6acSopenharmony_ci
556cd6a6acSopenharmony_ci**Where:**
566cd6a6acSopenharmony_ci
576cd6a6acSopenharmony_ci<table>
586cd6a6acSopenharmony_ci<colgroup>
596cd6a6acSopenharmony_ci<col width="25%" />
606cd6a6acSopenharmony_ci<col width="75%" />
616cd6a6acSopenharmony_ci</colgroup>
626cd6a6acSopenharmony_ci<tbody>
636cd6a6acSopenharmony_ci<tr class="odd">
646cd6a6acSopenharmony_ci<td align="left"><p><code>userrole</code></p></td>
656cd6a6acSopenharmony_ci<td align="left"><p>The <code>userrole</code> keyword.</p></td>
666cd6a6acSopenharmony_ci</tr>
676cd6a6acSopenharmony_ci<tr class="even">
686cd6a6acSopenharmony_ci<td align="left"><p><code>user_id</code></p></td>
696cd6a6acSopenharmony_ci<td align="left"><p>A previously declared SELinux <code>user</code> or <code>userattribute</code> identifier.</p></td>
706cd6a6acSopenharmony_ci</tr>
716cd6a6acSopenharmony_ci<tr class="odd">
726cd6a6acSopenharmony_ci<td align="left"><p><code>role_id</code></p></td>
736cd6a6acSopenharmony_ci<td align="left"><p>A previously declared <code>role</code> or <code>roleattribute</code> identifier.</p></td>
746cd6a6acSopenharmony_ci</tr>
756cd6a6acSopenharmony_ci</tbody>
766cd6a6acSopenharmony_ci</table>
776cd6a6acSopenharmony_ci
786cd6a6acSopenharmony_ci**Example:**
796cd6a6acSopenharmony_ci
806cd6a6acSopenharmony_ciThis example will associate `unconfined.user` to `unconfined.role`:
816cd6a6acSopenharmony_ci
826cd6a6acSopenharmony_ci```secil
836cd6a6acSopenharmony_ci    (block unconfined
846cd6a6acSopenharmony_ci        (user user)
856cd6a6acSopenharmony_ci        (role role)
866cd6a6acSopenharmony_ci        (userrole user role)
876cd6a6acSopenharmony_ci    )
886cd6a6acSopenharmony_ci```
896cd6a6acSopenharmony_ci
906cd6a6acSopenharmony_ciuserattribute
916cd6a6acSopenharmony_ci-------------
926cd6a6acSopenharmony_ci
936cd6a6acSopenharmony_ciDeclares a user attribute identifier in the current namespace. The identifier may have zero or more [`user`](cil_user_statements.md#user) and [`userattribute`](cil_user_statements.md#userattribute) identifiers associated to it via the [`userattributeset`](cil_user_statements.md#userattributeset) statement.
946cd6a6acSopenharmony_ci
956cd6a6acSopenharmony_ci**Statement definition:**
966cd6a6acSopenharmony_ci
976cd6a6acSopenharmony_ci```secil
986cd6a6acSopenharmony_ci    (userattribute userattribute_id)
996cd6a6acSopenharmony_ci```
1006cd6a6acSopenharmony_ci
1016cd6a6acSopenharmony_ci**Where:**
1026cd6a6acSopenharmony_ci
1036cd6a6acSopenharmony_ci<table>
1046cd6a6acSopenharmony_ci<colgroup>
1056cd6a6acSopenharmony_ci<col width="25%" />
1066cd6a6acSopenharmony_ci<col width="75%" />
1076cd6a6acSopenharmony_ci</colgroup>
1086cd6a6acSopenharmony_ci<tbody>
1096cd6a6acSopenharmony_ci<tr class="odd">
1106cd6a6acSopenharmony_ci<td align="left"><p><code>userattribute</code></p></td>
1116cd6a6acSopenharmony_ci<td align="left"><p>The <code>userattribute</code> keyword.</p></td>
1126cd6a6acSopenharmony_ci</tr>
1136cd6a6acSopenharmony_ci<tr class="even">
1146cd6a6acSopenharmony_ci<td align="left"><p><code>userattribute_id</code></p></td>
1156cd6a6acSopenharmony_ci<td align="left"><p>The <code>userattribute</code> identifier.</p></td>
1166cd6a6acSopenharmony_ci</tr>
1176cd6a6acSopenharmony_ci</tbody>
1186cd6a6acSopenharmony_ci</table>
1196cd6a6acSopenharmony_ci
1206cd6a6acSopenharmony_ci**Example:**
1216cd6a6acSopenharmony_ci
1226cd6a6acSopenharmony_ciThis example will declare a user attribute `users.user_holder` that will have an empty set:
1236cd6a6acSopenharmony_ci
1246cd6a6acSopenharmony_ci```secil
1256cd6a6acSopenharmony_ci    (block users
1266cd6a6acSopenharmony_ci        (userattribute user_holder)
1276cd6a6acSopenharmony_ci    )
1286cd6a6acSopenharmony_ci```
1296cd6a6acSopenharmony_ci
1306cd6a6acSopenharmony_ciuserattributeset
1316cd6a6acSopenharmony_ci----------------
1326cd6a6acSopenharmony_ci
1336cd6a6acSopenharmony_ciAllows the association of one or more previously declared [`user`](cil_user_statements.md#user) or [`userattribute`](cil_user_statements.md#userattribute) identifiers to a [`userattribute`](cil_user_statements.md#userattribute) identifier. Expressions may be used to refine the associations as shown in the examples.
1346cd6a6acSopenharmony_ci
1356cd6a6acSopenharmony_ci**Statement definition:**
1366cd6a6acSopenharmony_ci
1376cd6a6acSopenharmony_ci```secil
1386cd6a6acSopenharmony_ci    (userattributeset userattribute_id (user_id ... | expr ...))
1396cd6a6acSopenharmony_ci```
1406cd6a6acSopenharmony_ci
1416cd6a6acSopenharmony_ci**Where:**
1426cd6a6acSopenharmony_ci
1436cd6a6acSopenharmony_ci<table>
1446cd6a6acSopenharmony_ci<colgroup>
1456cd6a6acSopenharmony_ci<col width="25%" />
1466cd6a6acSopenharmony_ci<col width="75%" />
1476cd6a6acSopenharmony_ci</colgroup>
1486cd6a6acSopenharmony_ci<tbody>
1496cd6a6acSopenharmony_ci<tr class="odd">
1506cd6a6acSopenharmony_ci<td align="left"><p><code>userattributeset</code></p></td>
1516cd6a6acSopenharmony_ci<td align="left"><p>The <code>userattributeset</code> keyword.</p></td>
1526cd6a6acSopenharmony_ci</tr>
1536cd6a6acSopenharmony_ci<tr class="even">
1546cd6a6acSopenharmony_ci<td align="left"><p><code>userattribute_id</code></p></td>
1556cd6a6acSopenharmony_ci<td align="left"><p>A single previously declared <code>userattribute</code> identifier.</p></td>
1566cd6a6acSopenharmony_ci</tr>
1576cd6a6acSopenharmony_ci<tr class="odd">
1586cd6a6acSopenharmony_ci<td align="left"><p><code>user_id</code></p></td>
1596cd6a6acSopenharmony_ci<td align="left"><p>Zero or more previously declared <code>user</code> or <code>userattribute</code> identifiers.</p>
1606cd6a6acSopenharmony_ci<p>Note that there must be at least one <code>user_id</code> or <code>expr</code> parameter declared.</p></td>
1616cd6a6acSopenharmony_ci</tr>
1626cd6a6acSopenharmony_ci<tr class="even">
1636cd6a6acSopenharmony_ci<td align="left"><p><code>expr</code></p></td>
1646cd6a6acSopenharmony_ci<td align="left"><p>Zero or more <code>expr</code>'s, the valid operators and syntax are:</p>
1656cd6a6acSopenharmony_ci<p><code>    (and (user_id ...) (user_id ...))</code></p>
1666cd6a6acSopenharmony_ci<p><code>    (or  (user_id ...) (user_id ...))</code></p>
1676cd6a6acSopenharmony_ci<p><code>    (xor (user_id ...) (user_id ...))</code></p>
1686cd6a6acSopenharmony_ci<p><code>    (not (user_id ...))</code></p>
1696cd6a6acSopenharmony_ci<p><code>    (all)</code></p></td>
1706cd6a6acSopenharmony_ci</tr>
1716cd6a6acSopenharmony_ci</tbody>
1726cd6a6acSopenharmony_ci</table>
1736cd6a6acSopenharmony_ci
1746cd6a6acSopenharmony_ci**Example:**
1756cd6a6acSopenharmony_ci
1766cd6a6acSopenharmony_ciThis example will declare three users and two user attributes, then associate all the users to them as shown:
1776cd6a6acSopenharmony_ci
1786cd6a6acSopenharmony_ci```secil
1796cd6a6acSopenharmony_ci    (block users
1806cd6a6acSopenharmony_ci        (user user_1)
1816cd6a6acSopenharmony_ci        (user user_2)
1826cd6a6acSopenharmony_ci        (user user_3)
1836cd6a6acSopenharmony_ci
1846cd6a6acSopenharmony_ci        (userattribute user_holder)
1856cd6a6acSopenharmony_ci        (userattributeset user_holder (user_1 user_2 user_3))
1866cd6a6acSopenharmony_ci
1876cd6a6acSopenharmony_ci        (userattribute user_holder_all)
1886cd6a6acSopenharmony_ci        (userattributeset user_holder_all (all))
1896cd6a6acSopenharmony_ci    )
1906cd6a6acSopenharmony_ci```
1916cd6a6acSopenharmony_ci
1926cd6a6acSopenharmony_ciuserlevel
1936cd6a6acSopenharmony_ci---------
1946cd6a6acSopenharmony_ci
1956cd6a6acSopenharmony_ciAssociates a previously declared [`user`](cil_user_statements.md#user) identifier with a previously declared [`level`](cil_mls_labeling_statements.md#level) identifier. The [`level`](cil_mls_labeling_statements.md#level) may be named or anonymous.
1966cd6a6acSopenharmony_ci
1976cd6a6acSopenharmony_ci**Statement definition:**
1986cd6a6acSopenharmony_ci
1996cd6a6acSopenharmony_ci```secil
2006cd6a6acSopenharmony_ci    (userlevel user_id level_id)
2016cd6a6acSopenharmony_ci```
2026cd6a6acSopenharmony_ci
2036cd6a6acSopenharmony_ci**Where:**
2046cd6a6acSopenharmony_ci
2056cd6a6acSopenharmony_ci<table>
2066cd6a6acSopenharmony_ci<colgroup>
2076cd6a6acSopenharmony_ci<col width="25%" />
2086cd6a6acSopenharmony_ci<col width="75%" />
2096cd6a6acSopenharmony_ci</colgroup>
2106cd6a6acSopenharmony_ci<tbody>
2116cd6a6acSopenharmony_ci<tr class="odd">
2126cd6a6acSopenharmony_ci<td align="left"><p><code>userlevel</code></p></td>
2136cd6a6acSopenharmony_ci<td align="left"><p>The <code>userlevel</code> keyword.</p></td>
2146cd6a6acSopenharmony_ci</tr>
2156cd6a6acSopenharmony_ci<tr class="even">
2166cd6a6acSopenharmony_ci<td align="left"><p><code>user_id</code></p></td>
2176cd6a6acSopenharmony_ci<td align="left"><p>A previously declared SELinux <code>user</code> identifier.</p></td>
2186cd6a6acSopenharmony_ci</tr>
2196cd6a6acSopenharmony_ci<tr class="odd">
2206cd6a6acSopenharmony_ci<td align="left"><p><code>level_id</code></p></td>
2216cd6a6acSopenharmony_ci<td align="left"><p>A previously declared <code>level</code> identifier. This may consist of a single <code>sensitivity</code> with zero or more mixed named and anonymous <code>category</code>'s as discussed in the <code>level</code> statement.</p></td>
2226cd6a6acSopenharmony_ci</tr>
2236cd6a6acSopenharmony_ci</tbody>
2246cd6a6acSopenharmony_ci</table>
2256cd6a6acSopenharmony_ci
2266cd6a6acSopenharmony_ci**Example:**
2276cd6a6acSopenharmony_ci
2286cd6a6acSopenharmony_ciThis example will associate `unconfined.user` with a named [`level`](cil_mls_labeling_statements.md#level) of `systemlow`:
2296cd6a6acSopenharmony_ci
2306cd6a6acSopenharmony_ci```secil
2316cd6a6acSopenharmony_ci    (sensitivity s0)
2326cd6a6acSopenharmony_ci    (level systemlow (s0))
2336cd6a6acSopenharmony_ci
2346cd6a6acSopenharmony_ci    (block unconfined
2356cd6a6acSopenharmony_ci        (user user)
2366cd6a6acSopenharmony_ci         (userlevel user systemlow)
2376cd6a6acSopenharmony_ci        ; An anonymous example:
2386cd6a6acSopenharmony_ci        ;(userlevel user (s0))
2396cd6a6acSopenharmony_ci    )
2406cd6a6acSopenharmony_ci```
2416cd6a6acSopenharmony_ci
2426cd6a6acSopenharmony_ciuserrange
2436cd6a6acSopenharmony_ci---------
2446cd6a6acSopenharmony_ci
2456cd6a6acSopenharmony_ciAssociates a previously declared [`user`](cil_user_statements.md#user) identifier with a previously declared [`levelrange`](cil_mls_labeling_statements.md#levelrange) identifier. The [`levelrange`](cil_mls_labeling_statements.md#levelrange) may be named or anonymous.
2466cd6a6acSopenharmony_ci
2476cd6a6acSopenharmony_ci**Statement definition:**
2486cd6a6acSopenharmony_ci
2496cd6a6acSopenharmony_ci```secil
2506cd6a6acSopenharmony_ci    (userrange user_id levelrange_id)
2516cd6a6acSopenharmony_ci```
2526cd6a6acSopenharmony_ci
2536cd6a6acSopenharmony_ci**Where:**
2546cd6a6acSopenharmony_ci
2556cd6a6acSopenharmony_ci<table>
2566cd6a6acSopenharmony_ci<colgroup>
2576cd6a6acSopenharmony_ci<col width="25%" />
2586cd6a6acSopenharmony_ci<col width="75%" />
2596cd6a6acSopenharmony_ci</colgroup>
2606cd6a6acSopenharmony_ci<tbody>
2616cd6a6acSopenharmony_ci<tr class="odd">
2626cd6a6acSopenharmony_ci<td align="left"><p><code>userrange</code></p></td>
2636cd6a6acSopenharmony_ci<td align="left"><p>The <code>userrange</code> keyword.</p></td>
2646cd6a6acSopenharmony_ci</tr>
2656cd6a6acSopenharmony_ci<tr class="even">
2666cd6a6acSopenharmony_ci<td align="left"><p><code>user_id</code></p></td>
2676cd6a6acSopenharmony_ci<td align="left"><p>A previously declared SELinux <code>user</code> identifier.</p></td>
2686cd6a6acSopenharmony_ci</tr>
2696cd6a6acSopenharmony_ci<tr class="odd">
2706cd6a6acSopenharmony_ci<td align="left"><p><code>levelrange_id</code></p></td>
2716cd6a6acSopenharmony_ci<td align="left"><p>A previously declared <code>levelrange</code> identifier. This may be formed by named or anonymous components as discussed in the <code>levelrange</code> statement and shown in the examples.</p></td>
2726cd6a6acSopenharmony_ci</tr>
2736cd6a6acSopenharmony_ci</tbody>
2746cd6a6acSopenharmony_ci</table>
2756cd6a6acSopenharmony_ci
2766cd6a6acSopenharmony_ci**Example:**
2776cd6a6acSopenharmony_ci
2786cd6a6acSopenharmony_ciThis example will associate `unconfined.user` with a named [`levelrange`](cil_mls_labeling_statements.md#levelrange) of `low_high`, other anonymous examples are also shown:
2796cd6a6acSopenharmony_ci
2806cd6a6acSopenharmony_ci```secil
2816cd6a6acSopenharmony_ci    (category c0)
2826cd6a6acSopenharmony_ci    (category c1)
2836cd6a6acSopenharmony_ci    (categoryorder (c0 c1))
2846cd6a6acSopenharmony_ci    (sensitivity s0)
2856cd6a6acSopenharmony_ci    (sensitivity s1)
2866cd6a6acSopenharmony_ci    (sensitivityorder (s0 s1))
2876cd6a6acSopenharmony_ci    (sensitivitycategory s0 (c0 c1))
2886cd6a6acSopenharmony_ci    (level systemLow (s0))
2896cd6a6acSopenharmony_ci    (level systemHigh (s0 (c0 c1)))
2906cd6a6acSopenharmony_ci    (levelrange low_high (systemLow systemHigh))
2916cd6a6acSopenharmony_ci
2926cd6a6acSopenharmony_ci    (block unconfined
2936cd6a6acSopenharmony_ci        (user user)
2946cd6a6acSopenharmony_ci        (role role)
2956cd6a6acSopenharmony_ci        (userrole user role)
2966cd6a6acSopenharmony_ci        ; Named example:
2976cd6a6acSopenharmony_ci        (userrange user low_high)
2986cd6a6acSopenharmony_ci        ; Anonymous examples:
2996cd6a6acSopenharmony_ci        ;(userrange user (systemLow systemHigh))
3006cd6a6acSopenharmony_ci        ;(userrange user (systemLow (s0 (c0 c1))))
3016cd6a6acSopenharmony_ci        ;(userrange user ((s0) (s0 (c0 c1))))
3026cd6a6acSopenharmony_ci    )
3036cd6a6acSopenharmony_ci```
3046cd6a6acSopenharmony_ci
3056cd6a6acSopenharmony_ciuserbounds
3066cd6a6acSopenharmony_ci----------
3076cd6a6acSopenharmony_ci
3086cd6a6acSopenharmony_ciDefines a hierarchical relationship between users where the child user cannot have more privileges than the parent.
3096cd6a6acSopenharmony_ci
3106cd6a6acSopenharmony_ciNotes:
3116cd6a6acSopenharmony_ci
3126cd6a6acSopenharmony_ci-   It is not possible to bind the parent to more than one child.
3136cd6a6acSopenharmony_ci
3146cd6a6acSopenharmony_ci-   While this is added to the binary policy, it is not enforced by the SELinux kernel services.
3156cd6a6acSopenharmony_ci
3166cd6a6acSopenharmony_ci**Statement definition:**
3176cd6a6acSopenharmony_ci
3186cd6a6acSopenharmony_ci```secil
3196cd6a6acSopenharmony_ci    (userbounds parent_user_id child_user_id)
3206cd6a6acSopenharmony_ci```
3216cd6a6acSopenharmony_ci
3226cd6a6acSopenharmony_ci**Where:**
3236cd6a6acSopenharmony_ci
3246cd6a6acSopenharmony_ci<table>
3256cd6a6acSopenharmony_ci<colgroup>
3266cd6a6acSopenharmony_ci<col width="25%" />
3276cd6a6acSopenharmony_ci<col width="75%" />
3286cd6a6acSopenharmony_ci</colgroup>
3296cd6a6acSopenharmony_ci<tbody>
3306cd6a6acSopenharmony_ci<tr class="odd">
3316cd6a6acSopenharmony_ci<td align="left"><p><code>userbounds</code></p></td>
3326cd6a6acSopenharmony_ci<td align="left"><p>The <code>userbounds</code> keyword.</p></td>
3336cd6a6acSopenharmony_ci</tr>
3346cd6a6acSopenharmony_ci<tr class="even">
3356cd6a6acSopenharmony_ci<td align="left"><p><code>parent_user_id</code></p></td>
3366cd6a6acSopenharmony_ci<td align="left"><p>A previously declared SELinux <code>user</code> identifier.</p></td>
3376cd6a6acSopenharmony_ci</tr>
3386cd6a6acSopenharmony_ci<tr class="odd">
3396cd6a6acSopenharmony_ci<td align="left"><p><code>child_user_id</code></p></td>
3406cd6a6acSopenharmony_ci<td align="left"><p>A previously declared SELinux <code>user</code> identifier.</p></td>
3416cd6a6acSopenharmony_ci</tr>
3426cd6a6acSopenharmony_ci</tbody>
3436cd6a6acSopenharmony_ci</table>
3446cd6a6acSopenharmony_ci
3456cd6a6acSopenharmony_ci**Example:**
3466cd6a6acSopenharmony_ci
3476cd6a6acSopenharmony_ciThe user `test` cannot have greater privileges than `unconfined.user`:
3486cd6a6acSopenharmony_ci
3496cd6a6acSopenharmony_ci```secil
3506cd6a6acSopenharmony_ci    (user test)
3516cd6a6acSopenharmony_ci
3526cd6a6acSopenharmony_ci    (unconfined
3536cd6a6acSopenharmony_ci        (user user)
3546cd6a6acSopenharmony_ci        (userbounds user .test)
3556cd6a6acSopenharmony_ci    )
3566cd6a6acSopenharmony_ci```
3576cd6a6acSopenharmony_ci
3586cd6a6acSopenharmony_ciuserprefix
3596cd6a6acSopenharmony_ci----------
3606cd6a6acSopenharmony_ci
3616cd6a6acSopenharmony_ciDeclare a user prefix that will be replaced by the file labeling utilities described at [http://selinuxproject.org/page/PolicyStoreConfigurationFiles](http://selinuxproject.org/page/PolicyStoreConfigurationFiles#file_contexts.template_File) that details the `file_contexts` entries.
3626cd6a6acSopenharmony_ci
3636cd6a6acSopenharmony_ci**Statement definition:**
3646cd6a6acSopenharmony_ci
3656cd6a6acSopenharmony_ci```secil
3666cd6a6acSopenharmony_ci    (userprefix user_id prefix)
3676cd6a6acSopenharmony_ci```
3686cd6a6acSopenharmony_ci
3696cd6a6acSopenharmony_ci**Where:**
3706cd6a6acSopenharmony_ci
3716cd6a6acSopenharmony_ci<table>
3726cd6a6acSopenharmony_ci<colgroup>
3736cd6a6acSopenharmony_ci<col width="25%" />
3746cd6a6acSopenharmony_ci<col width="75%" />
3756cd6a6acSopenharmony_ci</colgroup>
3766cd6a6acSopenharmony_ci<tbody>
3776cd6a6acSopenharmony_ci<tr class="odd">
3786cd6a6acSopenharmony_ci<td align="left"><p><code>userprefix</code></p></td>
3796cd6a6acSopenharmony_ci<td align="left"><p>The <code>userprefix</code> keyword.</p></td>
3806cd6a6acSopenharmony_ci</tr>
3816cd6a6acSopenharmony_ci<tr class="even">
3826cd6a6acSopenharmony_ci<td align="left"><p><code>user_id</code></p></td>
3836cd6a6acSopenharmony_ci<td align="left"><p>A previously declared SELinux <code>user</code> identifier.</p></td>
3846cd6a6acSopenharmony_ci</tr>
3856cd6a6acSopenharmony_ci<tr class="odd">
3866cd6a6acSopenharmony_ci<td align="left"><p><code>prefix</code></p></td>
3876cd6a6acSopenharmony_ci<td align="left"><p>The string to be used by the file labeling utilities.</p></td>
3886cd6a6acSopenharmony_ci</tr>
3896cd6a6acSopenharmony_ci</tbody>
3906cd6a6acSopenharmony_ci</table>
3916cd6a6acSopenharmony_ci
3926cd6a6acSopenharmony_ci**Example:**
3936cd6a6acSopenharmony_ci
3946cd6a6acSopenharmony_ciThis example will associate `unconfined.admin` user with a prefix of "[`user`](cil_user_statements.md#user)":
3956cd6a6acSopenharmony_ci
3966cd6a6acSopenharmony_ci```secil
3976cd6a6acSopenharmony_ci    (block unconfined
3986cd6a6acSopenharmony_ci        (user admin)
3996cd6a6acSopenharmony_ci        (userprefix admin user)
4006cd6a6acSopenharmony_ci    )
4016cd6a6acSopenharmony_ci```
4026cd6a6acSopenharmony_ci
4036cd6a6acSopenharmony_ciselinuxuser
4046cd6a6acSopenharmony_ci-----------
4056cd6a6acSopenharmony_ci
4066cd6a6acSopenharmony_ciAssociates a GNU/Linux user to a previously declared [`user`](cil_user_statements.md#user) identifier with a previously declared MLS [`userrange`](cil_user_statements.md#userrange). Note that the [`userrange`](cil_user_statements.md#userrange) is required even if the policy is non-MCS/MLS.
4076cd6a6acSopenharmony_ci
4086cd6a6acSopenharmony_ci**Statement definition:**
4096cd6a6acSopenharmony_ci
4106cd6a6acSopenharmony_ci```secil
4116cd6a6acSopenharmony_ci    (selinuxuser user_name user_id userrange_id)
4126cd6a6acSopenharmony_ci```
4136cd6a6acSopenharmony_ci
4146cd6a6acSopenharmony_ci**Where:**
4156cd6a6acSopenharmony_ci
4166cd6a6acSopenharmony_ci<table>
4176cd6a6acSopenharmony_ci<colgroup>
4186cd6a6acSopenharmony_ci<col width="25%" />
4196cd6a6acSopenharmony_ci<col width="75%" />
4206cd6a6acSopenharmony_ci</colgroup>
4216cd6a6acSopenharmony_ci<tbody>
4226cd6a6acSopenharmony_ci<tr class="odd">
4236cd6a6acSopenharmony_ci<td align="left"><p><code>selinuxuser</code></p></td>
4246cd6a6acSopenharmony_ci<td align="left"><p>The <code>selinuxuser</code> keyword.</p></td>
4256cd6a6acSopenharmony_ci</tr>
4266cd6a6acSopenharmony_ci<tr class="even">
4276cd6a6acSopenharmony_ci<td align="left"><p><code>user_name</code></p></td>
4286cd6a6acSopenharmony_ci<td align="left"><p>A string representing the GNU/Linux user name</p></td>
4296cd6a6acSopenharmony_ci</tr>
4306cd6a6acSopenharmony_ci<tr class="odd">
4316cd6a6acSopenharmony_ci<td align="left"><p><code>user_id</code></p></td>
4326cd6a6acSopenharmony_ci<td align="left"><p>A previously declared SELinux <code>user</code> identifier.</p></td>
4336cd6a6acSopenharmony_ci</tr>
4346cd6a6acSopenharmony_ci<tr class="even">
4356cd6a6acSopenharmony_ci<td align="left"><p><code>userrange_id</code></p></td>
4366cd6a6acSopenharmony_ci<td align="left"><p>A previously declared <code>userrange</code> identifier that has been associated to the <code>user</code> identifier. This may be formed by named or anonymous components as discussed in the <code>userrange</code> statement and shown in the examples.</p></td>
4376cd6a6acSopenharmony_ci</tr>
4386cd6a6acSopenharmony_ci</tbody>
4396cd6a6acSopenharmony_ci</table>
4406cd6a6acSopenharmony_ci
4416cd6a6acSopenharmony_ci**Example:**
4426cd6a6acSopenharmony_ci
4436cd6a6acSopenharmony_ciThis example will associate `unconfined.admin` user with a GNU / Linux user "`admin_1`":
4446cd6a6acSopenharmony_ci
4456cd6a6acSopenharmony_ci```secil
4466cd6a6acSopenharmony_ci    (block unconfined
4476cd6a6acSopenharmony_ci        (user admin)
4486cd6a6acSopenharmony_ci        (selinuxuser admin_1 admin low_low)
4496cd6a6acSopenharmony_ci    )
4506cd6a6acSopenharmony_ci```
4516cd6a6acSopenharmony_ci
4526cd6a6acSopenharmony_ciselinuxuserdefault
4536cd6a6acSopenharmony_ci------------------
4546cd6a6acSopenharmony_ci
4556cd6a6acSopenharmony_ciDeclares the default SELinux user. Only one [`selinuxuserdefault`](cil_user_statements.md#selinuxuserdefault) statement is allowed in the policy. Note that the [`userrange`](cil_user_statements.md#userrange) identifier is required even if the policy is non-MCS/MLS.
4566cd6a6acSopenharmony_ci
4576cd6a6acSopenharmony_ci**Statement definition:**
4586cd6a6acSopenharmony_ci
4596cd6a6acSopenharmony_ci```secil
4606cd6a6acSopenharmony_ci    (selinuxuserdefault user_id userrange_id)
4616cd6a6acSopenharmony_ci```
4626cd6a6acSopenharmony_ci
4636cd6a6acSopenharmony_ci**Where:**
4646cd6a6acSopenharmony_ci
4656cd6a6acSopenharmony_ci<table>
4666cd6a6acSopenharmony_ci<colgroup>
4676cd6a6acSopenharmony_ci<col width="25%" />
4686cd6a6acSopenharmony_ci<col width="75%" />
4696cd6a6acSopenharmony_ci</colgroup>
4706cd6a6acSopenharmony_ci<tbody>
4716cd6a6acSopenharmony_ci<tr class="odd">
4726cd6a6acSopenharmony_ci<td align="left"><p><code>selinuxuserdefault</code></p></td>
4736cd6a6acSopenharmony_ci<td align="left"><p>The <code>selinuxuserdefault</code> keyword.</p></td>
4746cd6a6acSopenharmony_ci</tr>
4756cd6a6acSopenharmony_ci<tr class="even">
4766cd6a6acSopenharmony_ci<td align="left"><p><code>user_id</code></p></td>
4776cd6a6acSopenharmony_ci<td align="left"><p>A previously declared SELinux <code>user</code> identifier.</p></td>
4786cd6a6acSopenharmony_ci</tr>
4796cd6a6acSopenharmony_ci<tr class="odd">
4806cd6a6acSopenharmony_ci<td align="left"><p><code>userrange_id</code></p></td>
4816cd6a6acSopenharmony_ci<td align="left"><p>A previously declared <code>userrange</code> identifier that has been associated to the <code>user</code> identifier. This may be formed by named or anonymous components as discussed in the <code>userrange</code> statement and shown in the examples.</p></td>
4826cd6a6acSopenharmony_ci</tr>
4836cd6a6acSopenharmony_ci</tbody>
4846cd6a6acSopenharmony_ci</table>
4856cd6a6acSopenharmony_ci
4866cd6a6acSopenharmony_ci**Example:**
4876cd6a6acSopenharmony_ci
4886cd6a6acSopenharmony_ciThis example will define the `unconfined.user` as the default SELinux user:
4896cd6a6acSopenharmony_ci
4906cd6a6acSopenharmony_ci```secil
4916cd6a6acSopenharmony_ci    (block unconfined
4926cd6a6acSopenharmony_ci        (user user)
4936cd6a6acSopenharmony_ci        (selinuxuserdefault user low_low)
4946cd6a6acSopenharmony_ci    )
4956cd6a6acSopenharmony_ci```
496