5.1.3 All usernames and UIDs must be unique

Information

All users should have a unique UID. In particular the only user on the system to have a UID of 0 should be the root user. Likewise, usernames need to be verified as unique.

Rationale:

The only user with a UID of 0 on the system must be the root account. Any account (username) with a UID of 0 has super user privileges on the system and becomes root at login.

Access to the root account should be via su, sudo or PKI fingerprint. Logging must include sufficient information such that each action taken with root authority can be accounted to a specific account.

All accounts (or users) must have a unique UID to ensure that file and directory security is not compromised.

Impact:

Identification is the basis of Access Control. What you can access is determined by who you are (uid), OR by a group you belong to (resource GID and your group list) OR access is permitted to all (i.e., your UID and group list) do not match the resoource UID and GID values.

Solution

Examine the user IDs of all configured accounts:

cut -d: -f 3 /etc/passwd | sort -n | uniq -d

If a number, or numbers are returned from the command above, these are UID values which are not unique within the /etc/passwd file. Determine the effected accounts/s:

cut -d: -f 1 /etc/passwd | sort -n | uniq -d | while read UID; do
cut -f '1 3' -d : /etc/passwd |grep ':${UID}'
done

Examine the usernames IDs of all configured accounts:

cut -d: -f 1 /etc/passwd | sort -n | uniq -d

If a username, or usernames are returned from the command above, these are username values which are not unique within the /etc/passwd file. Determine the effected accounts/s:

cut -d: -f 1 /etc/passwd | sort -n | uniq -d | while read username; do
cut -f '1 3' -d : /etc/passwd |grep '${username}:'
done

NOTE: Any account names returned should either be deleted or have the UID changed
To remove:

rmuser <username>

To change the UID:

chuser id=<id> <username>

Default Value:

N/A

See Also

https://workbench.cisecurity.org/benchmarks/13069

Item Details

Category: ACCESS CONTROL

References: 800-53|AC-2, CSCv7|16.6

Plugin: Unix

Control ID: 4ecb20c8f92c76b74c41266c6b7c99399b86057ee9962d4284884f32e88f4f50