nerdexam
CompTIA

LX0-103 · Question #190

Which of the following chown commands will change the ownership to foo and the group to bar on a file named biglist?

The correct answer is C. chown foo:bar biglist. The chown command separates owner and group with a colon or dot in a single argument. Only the owner:group syntax is standard and correct.

GNU and Unix Commands

Question

Which of the following chown commands will change the ownership to foo and the group to bar on a file named biglist?

Options

  • Achown foo/bar biglist
  • Bchown -u foo -g bar biglist
  • Cchown foo:bar biglist
  • Dchown --user foo --group bar biglist

How the community answered

(25 responses)
  • B
    4% (1)
  • C
    92% (23)
  • D
    4% (1)

Why each option

The chown command separates owner and group with a colon or dot in a single argument. Only the owner:group syntax is standard and correct.

Achown foo/bar biglist

A forward slash is not a valid separator between owner and group in chown; the accepted separators are a colon (:) or a dot (.).

Bchown -u foo -g bar biglist

The chown command does not support -u or -g flags; those options belong to useradd and usermod for modifying user account attributes.

Cchown foo:bar biglistCorrect

The chown command accepts the syntax 'owner:group filename' (or 'owner.group filename') to simultaneously change both the file owner and the group. Using 'foo:bar biglist' sets the owner to foo and the group to bar in one operation as specified by POSIX.

Dchown --user foo --group bar biglist

chown does not provide --user or --group long options; these are not part of the chown command specification.

Concept tested: chown command syntax for simultaneous owner and group assignment

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

Topics

#chown#file ownership#group ownership

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice