|Lesson 5||Numeric access codes|
|Objective||Convert Alphabetic Permission Bits to Numeric Format.|
Convert Alphabetic Permission Bits to Numeric Format
The file permissions setting is stored on disk in numeric form, and working directly with this numeric representation is frequently the most convenient way to manipulate permissions.
In the numeric representation, the three permission bits (
x) at each level (user, group, other) are read as a 3-bit binary number, with
r having value 4,
having value 2, and
x having value 1.
rw- = 4 + 2 = 6
r-x = 4 + 1 = 5
--x = 1
Because the largest value possible (
) is 7, each set of permission bits can be represented by a single octal 
digit between 0 and 7.
The collection of all three sets of
bits is then represented as a three-digit octal number.
For example, the decimal number 10 means the number consists of one 10 and zero ones.
In octal, the decimal number 10 would be represented as 12 which is one 8 and two 1s.
rw-rw-r-- = 664
r--r--r-- = 444
rwx------ = 700
Converting Access Permissions
The owner of a process can send the process signals and can also reduce (degrade) the process’s scheduling priority.
Processes actually have multiple identities associated with them: a real, effective, and saved UID; a real, effective,
and saved GID; and under Linux, a "filesystem UID" that is used only to determine file access permissions. Broadly speaking, the real numbers are used for accounting and the effective numbers are used for the determination of access
permissions. The real and effective numbers are normally the same.
Saved IDs have no direct effect. They allow programs to park an inactive ID for later use, facilitating the parsimonious use of enhanced privileges. The filesystem UID is generally explained as an implementation detail of NFS and is usually the
same as the effective UID.
An octal number is a number based on 8s, just as a decimal number is based on 10s.