Question

I have 50+ scripts in folder cron-scripts, I only want exec them with cron shell only by root privileges.

# cd /var/www/html/cron-scripts/
# chown root:root scripts1.php
# chown fishman:users scripts1.php
# chown root:root scripts2.php
# chown fishman:users scripts2.php

Shall I use * to instead above code with the same effect?

# cd /var/www/html/cron-scripts/
# chown root:root *
# chown fishman:users *

And how to remove the root privileges if I have made chown root:root other-script.php?

I mean I want make this script open to all the public. (chown all-users:users other-script.php) thanks.

Was it helpful?

Solution

If you want to make a file readable by "others", you better use chmod with the parameters o+r which means "add read access for anyone else".

chmod o+r foo.bar

OTHER TIPS

If you wanted to apply chown to all files in a directory, you can use the recursive option chown -R user:group directory, instead of *

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top