220-1102 Question 249
Single answersudoA Linux help desk technician needs to update software on a user's Ubuntu workstation but does not know the root password. The technician's account has been added to the sudoers configuration. To install updates while following security best practices, which command should the technician use?
- A
sudo apt update && sudo apt upgrade
- B
su root && apt update && apt upgrade
- C
chmod 777 /etc/apt && apt upgrade
- D
login as root from the GUI and run apt upgrade
Show answer and explanation
Correct answer: A
Explanation
The best answer is to use sudo with the required administrative commands. In Linux, sudo is designed to let approved users perform specific tasks with elevated privileges while maintaining better security and accountability than direct root access. This aligns with the principle of least privilege: users operate as standard users and elevate only for specific commands. On Ubuntu and many other distributions, package management operations such as apt update and apt upgrade require administrative privileges, so using sudo is the standard method. This behavior is documented in the sudo manual (man sudo) and in Ubuntu administration guidance, which emphasizes using sudo instead of routine direct root logins.
- A. Correct.
Correct.
sudoallows an authorized user to run administrative commands with elevated privileges without directly logging in as the root user. On Ubuntu, package management tasks such asapt updateandapt upgraderequire administrative rights, so prefixing the commands withsudois the proper and secure approach. This also provides accountability because the action is tied to the technician's own user account. - B. Incorrect.
Incorrect.
su rootrequires the root account password, which the technician does not know in this scenario. In addition, Ubuntu commonly usessudofor administrative access instead of enabling direct root logins. A user who already has sudo privileges should usesudorather than attempting to switch to the root account. - C. Incorrect.
Incorrect. Changing permissions on
/etc/aptto777is a serious security mistake. It would make a sensitive system directory writable by any user, which could allow unauthorized changes to package configuration. It also does not correctly grant the privileges needed for package installation in a secure manner. This distractor reflects the misconception that file permissions can safely replace proper privilege escalation. - D. Incorrect.
Incorrect. Logging in directly as root from the GUI is not a best practice and is often disabled by default on many Linux distributions, including Ubuntu. Best practice is to use a standard account and elevate privileges only when needed with
sudo, reducing the risk of accidental system-wide changes and improving auditability.