Use the chmod command to change the access permissions of a file or directory.

# To give the [u]ser who owns a file the right to e[x]ecute it:
chmod u+x <file>

# To give the user rights to [r]ead and [w]rite to a file/directory:
chmod u+rw <file>

# To remove executable rights from the [g]roup:
chmod g-x <file>

# To give [a]ll users rights to read and execute:
chmod a+rx <file>

# To give [o]thers (not in the file owner's group) the same rights as the group:
chmod o=g <file>

# Give full access to user and group (i.e read, write and execute ) on a specific file.
chmod ug+rwx <file.txt>

# Revoke all access for the group (i.e read, write and execute ) on a specific file.
chmod g-rwx <file.txt>

# Apply the file permissions recursively to all the files in the sub-directories.
chmod -R ug+rwx <file.txt>

# Makes the permissions of file2 the same as file1 (GNU version only):
chmod --reference <file1> <file2>

# change pemissions (chmod) of all `css` and `js` files to 644:
find . -type f -iname "*.css" -or -iname " *.js" -exec chmod 644 {} \;
# NOTE: to preview changes first, remove the `-exec chmod 644 {} \;` part
find . -type f -iname "*.css" -or -iname " *.js" -exec echo {} \;

# Change all directories on your filesystem to a permissions level of 755:
find . -type d -exec chmod 755 {} \;

# This one looks for dynamic files (e.g., PHP scripts); it changes the ones
# it finds to a permissions level of 700.
find . -type f -iname "*.php*" -or -iname "*.cgi" -or -iname "*.pl" -or -iname "*.py" -or -iname "*.rb" -exec chmod 700 {} \;

# Change all apache config files to 644:
find /usr/local/etc/apache22 -type f -iname "*.conf" -exec chmod 644 {} \;