Linux and Command-Line Basics
Which of the following correctly describes the sudo command on Linux?
- AAnyone who knows the root password can run a command prefixed with sudo, and no record of who ran it is kept anywhere
- BA command prefixed with sudo is given a higher priority by the kernel than other processes and runs faster because it can use the CPU first
- CIt lets a user permitted in sudoers run a command with the privileges of another user (root by default), and by default the user enters their own password
Show answer and explanation
Answer: C. It lets a user permitted in sudoers run a command with the privileges of another user (root by default), and by default the user enters their own password
root is the administrator account (superuser) that can operate everything on the system, essentially without the restrictions of file permissions. sudo is a mechanism that lets only users permitted in /etc/sudoers or similar run individual commands with the privileges of root or another user; by default it confirms with the user's own password and records the commands run. Compared with sharing the root password and always logging in as root, it makes it easier to trace who did what, and strong privileges are used only when needed. Keeping privileges to the minimum necessary is based on the principle of least privilege in security.
- A. Only users permitted in sudoers can use sudo, and with the default settings the commands run are recorded.
- B. Changing processing priority is done with nice or renice. sudo changes privileges and does not change speed.
- C. Correct. A permitted user runs only the needed commands with another user's privileges.