Files/Directories
CHMOD

Each file has an assigned set of mode bits, ownership (user and group), and flags. To view these assignments, run the command ls -lo and get a result like this (only one file is shown)
-rw-r--r-- 1 root wheel sappnd,arch 2188 Sep 17 2003 junk.test

The first grouping of characters represent the modes assigned to the file.
root is the file's owner
wheel is the file's group
sappnd,arch are the file's flags

chmod changes the file's mode
chown changes the file's owner
chgrp changes the file's group
chflags changes the file's flags

Modes
Modes may be absolute or symbolic. An absolute mode is an octal number constructed from the sum of one or more of the following values:
4000(the setuid bit). Executable files with this bit set will run with effective uid set to the uid of the file owner. Directories with this bit set will force all files and sub- directories created in them to be owned by the directory owner and not by the uid of the creating process, if the underlying file system supports this feature: see chmod(2) and the suiddir option to mount(8) .
2000 (the setgid bit). Executable files with this bit set will run with effective gid set to the gid of the file owner.
1000(the sticky bit). See chmod(2) and sticky(8)
0400Allow read by owner.
0200Allow write by owner.
0100For files, allow execution by owner. For directories, allow the owner to search in the directory.
0040Allow read by group members.
0020Allow write by group members.
0010For files, allow execution by group members. For directo- ries, allow group members to search in the directory.
0004Allow read by others.
0002Allow write by others.
0001For files, allow execution by others. For directories allow others to search in the directory.


for example
chmod 4777 test.fil will set test.fil for full access by all while chmod 4777 /pub will allow full access to the /pub directory and chmod -R 4777 /pub will set full access to the /pub directory and all files and directories under /pub