Chmod

chmod is a Linux and OS X command that changes the permissions of a file.

Octal Permissions
Files have a specified owner (a single user) and group (a bunch of users). File permissions are stored in three parts: Each of these individual permissions is made of three bits: Read, Write, and eXecute.
 * 1) The owner's permissions
 * 2) The group members' permissions
 * 3) Everyone else's permissions

Viewing Permissions and Ownership
Run ls -l filename The output should look something like -rwxr-xr-- 1 lvuser root 420 Apr 20 04:20 filename We only really care about the second through tenth characters (i.e. the first chunk, except the first character. If you really care, a dash means a file, and "d" means directory). In this example,
 * 1) The owner can read, write, and execute (rwx)
 * 2) The group members can read and execute only (r-x)
 * 3) Everyone else can only read (r--)

Writing Permissions in Octal
Convert the triplets to binary in the obvious way (rwx=111, r--=100, etc.). Then just convert these to octal. Join them together into a three digit octal number (754 in our example above). Congrats, you did it!

All at once
Use the syntax chmod 754 filename to change the permissions of filename to 754

Individually
Use the syntax chmod [ugoa]*[+-=][rwx]* filename Where brackets mean choose one of the symbols. The asterisk means you can do it multiple times, so chmod ug+rx filename chmod o+w filename chmod a-w filename are all valid. Note that
 * u means owner
 * g means group
 * o means everyone
 * a is equivalent to ugo