Changing directory or file permissions or ownerships

Recursively change ownership of directories or files

find /www -type d -exec chown root:root {} \;

find /www -type -f -exec chown root:root {} \;

1: find directories under /www and execute the chown command on each directory found and change their ownership to root
2: find files under /www and execute the chown command on each directory found and change their ownership to root

 

Recursively change permissions for a directory or file

find /www -type d -exec chmod 644 {} \;

find /www -type f -exec chmod 644 {} \;