I'm trying to find how to make a script to automate permission changes and then program it with cron.
I have created a directory in / home with a group and certain permissions, and I have added the users to that group.
As you know, if users create directories and / or files within this directory, they will inherit these permissions and group. The problem comes when users "paste" files already created, the permissions do not change.
I want to run a task that changes permissions and group every x time, but I do not know how to program it.
I imagine that I have to make a script, of this I do not have much idea, with the following:
sudo chgrp -R grupo /home/directorio chmod -R 774 /home/directorio
And then schedule that script with cron. I have the problem with the script. I do not know how to write it and apply root permissions, keeping in mind that it has to be run in unattended mode.