220-1102 exam dumps

220-1102 practice question 249 of 828

A+ Core 2. Associate level, CompTIA. Free question with the correct answer and a full explanation.

220-1102 Question 249

Single answersudo

A 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?

  1. A

    sudo apt update && sudo apt upgrade

  2. B

    su root && apt update && apt upgrade

  3. C

    chmod 777 /etc/apt && apt upgrade

  4. 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. sudo allows an authorized user to run administrative commands with elevated privileges without directly logging in as the root user. On Ubuntu, package management tasks such as apt update and apt upgrade require administrative rights, so prefixing the commands with sudo is 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 root requires the root account password, which the technician does not know in this scenario. In addition, Ubuntu commonly uses sudo for administrative access instead of enabling direct root logins. A user who already has sudo privileges should use sudo rather than attempting to switch to the root account.

  • C. Incorrect.

    Incorrect. Changing permissions on /etc/apt to 777 is 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.

Timed practice exam

Take a 220-1102 practice test under exam conditions

90 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam