Advanced file permissions Linux
Sticky Bit
The sticky bit is set on a directory as a way to prevent users from removing files that they do not own. It is represented by the t over the x position on the other octal as in -rwxrwxrwt or -rwxrwxrwT when the x bit is not set on other.
You can set it by using chmod 1775 or chmod +t
Setgid bit on directory
The setuid can be set on a directory to ensure that all files inside the directory are owned by the group owner of the directory. It is represented by the s over the x position on the group octal as in -rwxrwsrwx or -rwxrwSrwx when the x bit is not set on group.
You can set it by using chmod 2775 or chmod g+s
Setgid and Setuid on files
When setuid is set on a file it causes the file to be executed by the file owner instead of the executing owner and when setgid is set on a file it causes the file to be executed by the file group instead of the executing owner.
To change permissions on all directories in a folder cd into it and run
sudo find . -type d -exec chmod xxxx {} \ ;
or for files
sudo find . -type f -exec chmod xxxx {} \ ;
where xxxx is your octals like 2755 or u=rwx,g=rx,o=r for example chmod 2755 or chmod u=rwx,g=rx,o=r