TMAegisBeta
更多 linux 規則

Linux distributions

TMA-ROCKY9-7.2.4

Ensure no duplicate UIDs exist

中等級 1自動化linux

說明

Although the useradd program will not let you create a duplicate User ID (UID), it is possible for an administrator to manually edit the /etc/passwd file and change the UID field.

檢查方式

稽核方法: Shell 指令

shell
alt0() { o=$(bash -c '#!/usr/bin/env bash

{
  while read -r l_count l_uid; do
    if [ "$l_count" -gt 1 ]; then
      echo -e "Duplicate UID: \"$l_uid\" Users: \"$(awk -F: '"'"'($3 == n) { print $1 }'"'"' n=$l_uid /etc/passwd | xargs)\""
    fi
  done < <(cut -f3 -d":" /etc/passwd | sort -n | uniq -c)
}' 2>&1); [ -z "$o" ] || { echo "step1: $o" | head -c 300; return 1; }; }; if alt0; then echo compliant; fi
預期輸出
compliant

修補方式

修補方法: 操作指南或基礎設施修補檔

Based on the Audit Procedure output, for each UID shared by more than one account, keep the UID on the correct account and assign a new, unused UID to each of the other accounts: # usermod -u <UID> <username> usermod reassigns ownership of files in the account's home directory automatically. Review any other files owned by the previously shared UID and reassign ownership to the correct account as appropriate.

屬性

作業系統
rocky-9
標籤
cis-convertedlinux
參考資料
CIS Rocky Linux 9 Benchmark v3.0.0 - 7.2.4

檢查此主機

請在您有權稽核的機器上執行此指令。掃描為唯讀操作。

shell
tmaegis scan --target linux