010-160 practice question 15 of 15

What is true about the su command?

Full set: 81 questions
Answer options
A: It is the default shell of the root account.
B: It can only be used by the user root.
C: It runs a shell or command as another user. Correct answer
D: It changes the name of the main administrator account.
E: It locks the root account in specific time frames.
Correct Answer:
C. It runs a shell or command as another user.
Explanation

The su (substitute user) command is a standard Unix/Linux utility used to switch to another user account. Its primary purpose is to execute commands with the privileges of that other user. When invoked without a username, it defaults to the superuser, root. It can be used to start an interactive shell (e.g., su - anotheruser) or to run a single command with the target user's identity (e.g., su -c 'command' anotheruser). This allows for privilege escalation or impersonation for administrative tasks without requiring a full login session.

Why Incorrect

A. The default shell for the root account is an executable program (like /bin/bash) specified in the /etc/passwd file, not the su command itself.
B. Any user can use the su command to attempt to switch to another user, provided they can authenticate with the target user's password.
D. The usermod command is used to modify user account attributes, including changing the account name (usermod -l newname oldname).
E. Account locking is managed through utilities like passwd -l or usermod -L, or by configuring Pluggable Authentication Modules (PAM), not by su. ---

References

1. Linux man-pages project, su(1):

Reference: In the NAME section, it is defined as "su - run a command with substitute user and group ID". The DESCRIPTION section further clarifies, "The su command is used to become another user during a login session."

Source: man su(1), util-linux package documentation. Available via man su on most Linux systems or online at man7.org.

2. Red Hat Enterprise Linux 8 Documentation, "Configuring basic system settings":

Reference: Chapter 26, Section 26.8, "Switching users". The documentation states, "To switch to another user account in the command line, for example root, use the su command... You can run a command as another user without interactively switching to that account. To do so, use the su -c command".

Source: Red Hat Customer Portal, RHEL 8 Documentation.

3. University of California, Berkeley, EECS Courseware (CS 161: Computer Security):

Reference: Lecture notes on "Unix Security & Permissions" often describe the principle of least privilege and the tools to manage it. The su command is presented as the traditional method to temporarily gain superuser privileges to perform a specific task. For example, "The su command ('substitute user') allows you to run a shell as another user."

Source: Course materials for CS 161, often available publicly on the university's EECS department website.

Scroll to Top