Set the owner of /usr/local/bin/report to root and its group to ops.
Change mode bits separately.
Which command is appropriate?
chown OWNER:GROUP FILE changes both the file owner and group. Permission to make the change is normally required.
Detailed explanation
chmod root:ops /usr/local/bin/reportIncorrect. chmod changes mode bits and does not set owner:group.
chown root:ops /usr/local/bin/reportCorrect. chown root:ops sets both ownership fields.
chgrp root:ops /usr/local/bin/reportIncorrect. chgrp handles a group, not the owner:group form.
usermod root:ops /usr/local/bin/reportIncorrect. usermod changes account attributes, not file ownership.
Try it yourself
An example you can run in a temporary verification environment.
chown --help | sed -n '1,12p'Expected result
OWNER[:GROUP]形式を含むchownの使用法Key points
- chown changes ownership
- The colon separates owner and group
- The operation requires permission
Notes
- Environment: GNU coreutils chown / ヘルプ表示のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Shell function
A reusable group of commands that runs in the caller's shell context.
Positional parameter
A numbered argument or special value supplied to a script or function.
Control flow
Conditions, loops, and exit statuses determine which shell commands run.