I am trying to figure out a way to recursively set permissions for dirs and subdirs on a specific path and 600 for files. I would use the following commands:
find / path-type d -print0 | xargs -0 chmod 700
find / path -type f -print0 | xargs -0 chmod 600
But the user does not have permission to run the Find command. As a workaround, I tried to create a script that contains the above commands from the root user with the setuid bit set, so it will run with root privileges (such as passwd or sudo commands that ordinary users run with root privileges):
chmod 4755 script.sh
but I canβt execute the script from the limited user account, it still says that I donβt have permission to run the find command.
Does anyone know how I can do this without using the find command?
Edit: OS: Centos 6.5
source share