In terminal I know I can
chown whatever:whatever .*
What I want to do is dynamically set username and group to the current domain owner rather than root. Is there an easy way to do this?
Some background: I'm pushing to my server using Git as root then checking out to public_html. This makes any new files and directories owned by root:root. I want to add a line to hooks/post-receive to change the owner to the domain user rather than root but I don't want to have to specify the domain user explicitly if I don't have to.
The simples think I could think of is
chown -R `stat . -c %u:%g` *
You might also use $(...) instead of backticks here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With