Keep deploy.sh's owner and change only its owning group to ops using chown.
Which form is appropriate?
chown :GROUP FILE omits the owner component and changes only the group.
Detailed explanation
chown ops deploy.shIncorrect. chown ops deploy.sh treats ops as the owner.
Incorrect. chown ops deploy.sh treats ops as the owner.
chown :ops deploy.shCorrect. chown :ops deploy.sh preserves the owner and changes the group.
Correct. chown :ops deploy.sh preserves the owner and changes the group.
chown ops: deploy.shIncorrect. chown ops: can change the owner and may set its login group.
Incorrect. chown ops: can change the owner and may set its login group.
chown .:ops deploy.shIncorrect. The dot form is not the standard portable syntax here.
Incorrect. The dot form is not the standard portable syntax here.
Try it yourself
An example you can run in a temporary verification environment.
chown --help | sed -n '1,5p'Expected result
OWNER[:[GROUP]]形式を含む使用法。属性変更は行わないKey points
- OWNER:GROUP
- :GROUP changes only group
- OWNER: may also change login group
Notes
- Environment: GNU coreutils 9.x / helpのみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.