nerdexam
CompTIA

LX0-103 · Question #56

Which of the following commands makes /bin/foo executable by everyone but writable only by its owner?

The correct answer is A. chmod u=rwx,go=rx /bin/foo. Making a file executable by everyone but writable only by its owner requires the 755 (rwxr-xr-x) permission set, which the symbolic expression u=rwx,go=rx produces exactly.

GNU and Unix Commands

Question

Which of the following commands makes /bin/foo executable by everyone but writable only by its owner?

Options

  • Achmod u=rwx,go=rx /bin/foo
  • Bchmod o+rwx,a+rx /bin/foo
  • Cchmod 577 /bin/foo
  • Dchmod 775 /bin/foo

How the community answered

(36 responses)
  • A
    78% (28)
  • B
    14% (5)
  • C
    6% (2)
  • D
    3% (1)

Why each option

Making a file executable by everyone but writable only by its owner requires the 755 (rwxr-xr-x) permission set, which the symbolic expression u=rwx,go=rx produces exactly.

Achmod u=rwx,go=rx /bin/fooCorrect

The clause u=rwx explicitly sets owner permissions to read, write, and execute. The clause go=rx sets both group and others to read and execute only, denying write access to non-owners. Together these produce the 755 (rwxr-xr-x) bit pattern, satisfying both requirements.

Bchmod o+rwx,a+rx /bin/foo

The token o+rwx adds write permission to the others class, which directly violates the requirement that only the owner may write to the file.

Cchmod 577 /bin/foo

Octal 577 translates to r-x/rwx/rwx, which denies write permission to the owner while granting it to both group and others - the opposite of the stated requirement.

Dchmod 775 /bin/foo

Octal 775 translates to rwx/rwx/r-x, which grants write permission to the group in addition to the owner, violating the writable-only-by-owner constraint.

Concept tested: chmod symbolic notation for precise permission assignment

Source: https://man7.org/linux/man-pages/man1/chmod.1.html

Topics

#chmod#file permissions#symbolic mode#execute bit

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice