To change all the directories to 755 (-rwxr-xr-x):
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
Источник:
http://stackoverflow.com/questions/3740152/how-to-...lders-and-files-in-linux-ubunt
А также:
http://superuser.com/questions/91935/how-to-chmod-...ories-except-files-recursively
Или вот так для директорий:
chmod 0770 `find /path/* -type d`
и так для файлов:
chmod 0660 `find /path/* -type f`
Обход будет рекурсивным, в глубину, в обоих случаях.