easyMultiple ChoiceObjective-mapped
220-1202 Practice Question: A software deployment script fails because it…
A software deployment script fails because it cannot write to the /opt/app directory. The directory currently has permissions drwxr-xr-x and is owned by root. The script runs as a non-root user. Which command would allow the script to write files without compromising security more than necessary?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
chmod o+w /opt/app
Chmod o+w /opt/app adds write permission for 'others' (the non-root user), which is the minimal change needed. The script runs as a non-root user, so this grants write access without affecting group permissions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
chmod o+w /opt/app
Why this is correct
The `chmod o+w /opt/app` command correctly adds write permission specifically for 'others' (users who are neither the owner nor in the owning group of the directory). If the deployment script runs as a non-root user that falls into this 'others' category, this command provides the necessary write access for the script to succeed. This approach adheres to the principle of least privilege by granting only the required permission without affecting owner or group access, thus maintaining a more secure system configuration.
- ✗
chmod 777 /opt/app
Why it's wrong here
The `chmod 777 /opt/app` command grants full read, write, and execute permissions to the owner, the group, and all 'others' on the system. While this would undoubtedly resolve the script's write permission issue, it is an excessive and highly insecure solution. Allowing any user or process to modify or execute files within `/opt/app` creates a significant security vulnerability, potentially leading to data corruption, unauthorized code execution, or system compromise.
- ✗
chown user:user /opt/app
Why it's wrong here
The `chown user:user /opt/app` command changes the ownership of the `/opt/app` directory to a specific 'user' and 'user' group. While this would grant the specified user full control, including write access, it is not the minimal or most appropriate solution for a simple permission issue. Altering ownership can disrupt other system processes or applications that expect `/opt/app` to be owned by `root` or another designated system account, potentially causing new operational failures or security concerns.
- ✗
chmod g+w /opt/app
Why it's wrong here
The `chmod g+w /opt/app` command adds write permission exclusively for the *group* that owns the `/opt/app` directory. If the deployment script is executing as a user who is not a member of this specific owning group, then granting group write permissions will have no impact on the script's ability to write. This command would only be effective if the script's executing user was explicitly part of the directory's group, which is not implied by the problem statement.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 220-1202 question from scratch — 495 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 220-1202 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 220-1202 exam.