Knowing File Permissions in Linux
Not understanding about file permissions in Linux ? I'll give a simple explanation about that and hopefully it will be usefull.
in Linux can be read=r, write=w and execute=x. There
are 3 categories of ownership for each file and directory:
a valid user with an entry in /etc/passwd
a valid group with an entry in /etc/group
For example :
[email protected]:~$ ls -l
-rw-r--r-- 1 root root 351 2007-09-27 12:39 symlink
drwxr-xr-x 2 jafar jafar 48 2008-04-30 18:33 tes
-rw-r--r-- 1 jafar jafar 7365 2007-10-29 13:13 tes.pl
The first character indicates the type of file, and the next three
indicate read, write, and execute permission for each of the three user
types, user, group and other. Since there are three types of permission
for three users, there are a total of nine permission bits. The table
below shows the syntax:
|File||User Permissions||Group Permissions||Other Permissions|
- Character 1 is the type of file: - is ordinary, d is directory, l is link.
- Characters 2-4 show owner permissions. Character 2 indicates
read permission, character 3 indicates write permission, and character
4 indicates execute permission.
- Characters 5-7 show group permissions. Character 5=read, 6=write, 7=execute
- Characters 8-10 show permissions for all other users. Character 8=read, 9=write, 10=execute
So if we have something like this -rw-r--r--, we can say this file : for user (read+write), for group (read only) and for other (read only).
and symbolic permissions.
We can also use octal notation to give permission in a file or directory.
apply to the user, the group and to others. An item has a set of 3
grouped permissions for each of these categories.
to translate -rw-r--r-- in octal notation
-rw-r--r-- = 644 in octal notation
-rwxrwxrw- = 775 in octal notation
system create files and directories with standard permissions as
Files 666 -rw-rw-rw-
Directories 777 -rwxrwxrwx
Not difficult isnt it.
- roemasa's blog
- Add new comment
- 574 reads