Interview Prep/Linux/Users, groups and access control

You suspect someone added an extra UID 0 account. How do you check and respond?

IntermediateScenarioUsers, groups and access control
Answer

Situation read → Hidden root accounts are a classic backdoor.

What I'd do →

awk -F: '$3==0 {print $1}' /etc/passwd
awk -F: '$2=="" {print $1}' /etc/shadow      # empty passwords
ls -l /etc/passwd /etc/shadow; rpm -V setup 2>/dev/null || debsums -c 2>/dev/null
lastlog | head; last -F | head

If anything besides root shows UID 0, treat the host as compromised: isolate, preserve evidence, and investigate rather than just deleting the line.

Why → An attacker with root can add accounts; removing the symptom leaves the way they got in open.

Interview tip → Mention monitoring /etc/passwd with auditd (-w /etc/passwd -p wa -k identity) or file integrity tools like AIDE.

All Linux questions Roadmap: Linux

More on Users, groups and access control