In order to understand these numeric modes, you must first understand that these modes are actually represented by the system as three octal digits, one each for the user, the group, and others. Within each category, the Read/Write/eXecute bits are represented by the bits of an octal digit. The Read bit is in the 4s place, the Write bit is in the 2s place, and the eXecute bit is in the 1s place.

USER GROUP OTHER

r w x r w x r w x

4 2 1 4 2 1 4 2 1

In order to determine the numeric code for a given set of permissions, you just add up the octal digits for the modes that are on. For example, if a file is readable and writable by the user and read-only for the group and others, the numeric mode would be 644, as illustrated below:

USER GROUP OTHER

r w – r – - r – -

4+2 4 4

Similarly, a directory that has permissions ‘rwxr-xr-x’ would have an octal mode of 755. You can use this numeric mode to set permissions. For example,

chmod 644 somefile

sets the permission of the file to ‘rw-r–r–’.

via IUCS CSG FAQ – How do I use Unix file permissions?.