I use two commands to change permissions, to ensure that all folders are executable, and all files are not:
Code:
sudo chmod -R u=rw,go= /home/username
sudo chmod -R u+X /home/username
This works, but then I put the commands (without sudo) into a script and run the script with sudo
The script runs and the first command is executed, the second complains it can't find a numerical filepath.
If I reissue the second command manually, all is well.
Yet if I replace the second command with the following:
Code:
find /home/username -type d -exec chmod 700 {} \;
the revised script runs without problems (just slower). Question is, why do the original two commands work outside a script, but fail within it. Using Ubuntu 9.10 (script used to work in Fedora 10 using 'su -c'). I tried enabling su in Ubuntu but the script still didn't work correctly.
Any ideas?