nerdexam
CompTIA

LX0-103 · Question #143

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

The correct answer is D. chmod 755/bin/foo. The octal mode 755 sets rwxr-xr-x, giving the owner read, write, and execute permissions while restricting group and others to read and execute only.

GNU and Unix Commands

Question

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

Options

  • Achmod 557 /bin/foo
  • Bchmod o+rwx.a+rx/bin/foo
  • Cchown 557 /bin/foo
  • Dchmod 755/bin/foo

How the community answered

(29 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    7% (2)
  • D
    86% (25)

Why each option

The octal mode 755 sets rwxr-xr-x, giving the owner read, write, and execute permissions while restricting group and others to read and execute only.

Achmod 557 /bin/foo

chmod 557 sets r-xr-xrwx, which grants others full write and execute permissions, directly violating the requirement that only the owner can write to the file.

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

The syntax is malformed - there is no space between the mode string and the path, and the mode expression itself mixes symbolic and relative notation incorrectly, making the command invalid.

Cchown 557 /bin/foo

chown modifies file ownership (user and group), not the read, write, or execute permission bits; it cannot set or change any access permissions.

Dchmod 755/bin/fooCorrect

In octal notation, 755 breaks down as owner=7 (rwx), group=5 (r-x), others=5 (r-x). The owner retains write permission while group and others have only read and execute access, satisfying the requirement of executable by everyone but writable only by the owner. No other choice in the list produces this exact permission set.

Concept tested: Linux chmod octal permission notation

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

Topics

#file permissions#chmod#access control#command line

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice