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.
chown :ops deploy.shCorrect. 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.
chown .:ops deploy.shIncorrect. 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のみ
- Use a disposable file or directory when checking chmod calculations.
- Exact permission display can vary slightly with filesystem and distribution defaults.
Foundation review
Place the operation
The colon separates owner and group; which side is empty determines which ownership field is preserved.
Check the side effect
Use the explicit form that matches the intended field and verify the result with a read-only listing.