Change owner for all folders and files in a folder
sudo chown -R user:group /path/to/dir/
Where user is new owner, group - new group of user.
-R indicates that the operation must be run recursively.
Changing the permissions to the file or folder
chmod -R 700 /path/to/file/or/dir
-R indicates that the operation must be run recursively.
Changing the permissions only for files
find /path/to/dir -type f -exec chmod 600 {} \;
Changing the permissions only for folders
find /path/to/dir -type d -exec chmod 700 {} \;