Changes

Jump to: navigation, search

File permissions

720 bytes added, 7 years ago
Explanations about chmod
== File permissions ==
With Linux, the most common way to handle user rights provides three distinct rights on files. The meaning of these rights for directories (which '''are''' files in Linux) is slightly different.worths
{|class="table table-striped"
! Subject || Right (Oct. repr.) || Description || Typical granted commands
|-
|rowspan=3| '''File''' || <code>r (4)</code> || Read || cat ''f'', less ''f'', grep ''f'', file ''f''
|| <code>x (1)</code> || Browse hierarchy || cd ''d'', pushd ''d''
|}
 
You would notice that rights octal representation is coded with powers of 2. This is a common way to represent bunch two-states settings that can be independently toggled. Indeed, a file does not properly ''have'' a list of permissions set, you should see this rather as a a bit string (where a '''1''' at the position '''i''' means '''ON''' and a '''0''' means '''OFF''' for the right coded '''2<sup>i</sup>''').
 
An example is worth 1000 words:
 
<pre>
-rwx Octal Permissions
0000 0 None
0001 1 Execution only
0010 2 Read only
0100 4 Write only
0111 7 All (ie. Read and Write and Execution)
0110 6 All but Execution (ie. Read and Write)
</pre>
File permissions are split into three categories of users:
wiki-staff
336
edits

Navigation menu