Courseiva
Essential Commands →mediumMultiple Choice

LFCS Essential Commands Practice Question

A user reports that a script fails with 'Permission denied' when executed. The script has permissions -rw-r--r-- and is owned by the user. Which command should the user run to make the script executable for the owner only?

⚠ Common exam trap

Test-takers frequently confuse the setuid bit (`u+s`) with the execute bit (`u+x`), or assume that `chmod +x` is equivalent to `chmod u+x`, when in fact the former grants execute to all users, which is not what the question asks.

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 u+x script.sh

The script currently has permissions `-rw-r--r--`, meaning the owner has read and write but not execute permission. The `chmod u+x` command adds the execute permission for the owner only, which is exactly what the user needs to run the script without affecting group or others.

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 u+s script.sh

    Why it's wrong here

    chmod u+s sets the setuid bit, which changes the effective UID during execution rather than granting execute permission; the file remains -rw-r--r--. It is tempting because setuid is used when a program must run with the file owner's privileges, not to make a script runnable.

  • ✓

    chmod u+x script.sh

    Why this is correct

    The file lacks execute permission for the owner, producing 'Permission denied'. chmod u+x adds execute only for the owner, matching the requirement to make it executable for the owner alone without altering group or other permissions.

  • ✗

    chown :users script.sh

    Why it's wrong here

    Changing group ownership with chown :users does not alter the mode bits, so the file stays -rw-r--r-- and still lacks execute permission. It is tempting because chown fixes ownership-related access failures, and would be correct if the script were owned by the wrong user or group.

  • ✗

    chmod +x script.sh

    Why it's wrong here

    chmod +x grants execute permission to owner, group and others, whereas the requirement is owner only. It is tempting because it does resolve the immediate 'Permission denied' error, and would be correct if execute access for all users were acceptable.

About these practice questions

This LFCS question is part of Courseiva's 406-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.