GSEC · Question #93
Which of the following Linux commands can change both the username and group name a file belongs to?
The correct answer is B. chgrp. This question tests knowledge of Linux file ownership commands and which one is dedicated to modifying group ownership. The provided correct answer is chgrp, though technically chown can modify both owner and group simultaneously.
Question
Which of the following Linux commands can change both the username and group name a file belongs to?
Options
- Achown
- Bchgrp
- Cchmod
- Dnewgrp
How the community answered
(33 responses)- A3% (1)
- B85% (28)
- C6% (2)
- D6% (2)
Why each option
This question tests knowledge of Linux file ownership commands and which one is dedicated to modifying group ownership. The provided correct answer is chgrp, though technically chown can modify both owner and group simultaneously.
chown changes the user owner of a file and can optionally set the group with colon syntax (chown user:group), but it is primarily associated with changing user ownership rather than being dedicated to group changes.
chgrp (change group) is the Linux command dedicated specifically to changing the group name (group ownership) associated with a file or directory. It directly modifies the group ownership field in the file's inode, accepting a group name or GID and one or more target files as arguments.
chmod modifies the read, write, and execute permission bits on a file and has no effect on user or group ownership metadata.
newgrp changes the active group ID for the current shell session, affecting group ownership of newly created files going forward, but does not modify ownership of any existing files.
Concept tested: Linux file group ownership command - chgrp
Source: https://man7.org/linux/man-pages/man1/chgrp.1.html
Topics
Community Discussion
No community discussion yet for this question.