Bird
0
0

Why does the whoami command always show the effective user, even if you switch users with su?

hard📝 Conceptual Q10 of 15
Linux CLI - Users and Groups
Why does the whoami command always show the effective user, even if you switch users with su?
ABecause <code>whoami</code> caches the first login username
BBecause <code>whoami</code> shows the effective user ID, not the original login user
CBecause <code>su</code> does not change the user context
DBecause <code>whoami</code> reads from the /etc/passwd file only
Step-by-Step Solution
Solution:
  1. Step 1: Understand effective user concept

    whoami shows the effective user ID, which changes when you use su to switch users.
  2. Step 2: Eliminate incorrect options

    whoami does not cache usernames, su changes user context, and whoami does not just read /etc/passwd.
  3. Final Answer:

    Because whoami shows the effective user ID, not the original login user -> Option B
  4. Quick Check:

    whoami = effective user ID [OK]
Quick Trick: whoami shows current effective user, not original login [OK]
Common Mistakes:
  • Thinking whoami shows original login user
  • Believing su does not change user
  • Assuming whoami reads static files only

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes