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.
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)- B4% (1)
- C92% (23)
- D4% (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.
A forward slash is not a valid separator between owner and group in chown; the accepted separators are a colon (:) or a dot (.).
The chown command does not support -u or -g flags; those options belong to useradd and usermod for modifying user account attributes.
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.
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
Community Discussion
No community discussion yet for this question.