nerdexam
GIAC

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.

Linux and Cryptography

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)
  • A
    3% (1)
  • B
    85% (28)
  • C
    6% (2)
  • D
    6% (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.

Achown

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.

BchgrpCorrect

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.

Cchmod

chmod modifies the read, write, and execute permission bits on a file and has no effect on user or group ownership metadata.

Dnewgrp

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

#chown#chgrp#file permissions#Linux commands

Community Discussion

No community discussion yet for this question.

Full GSEC Practice