LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   drwxr-xr-x 2 File permission (https://www.linuxquestions.org/questions/linux-newbie-8/drwxr-xr-x-2-file-permission-823941/)

moiseszaragoza 08-03-2010 04:00 PM

drwxr-xr-x 2 File permission
 
i have 2 types of files. well i have the same file type with permission.
and i was wondering if any one could tell me how to properly read them

permission type 1 = "-rw-r--r-- 1"
permission type 2 = "drwxr-xr-x 2"

Thanks.

moiseszaragoza 08-03-2010 04:01 PM

i was reading http://www.redhat.com/docs/manuals/l...ownership.html
and it looks like that 1 and 2 are not part of the permission but i don't know what it stands for

Telengard 08-03-2010 05:18 PM

Quote:

Originally Posted by moiseszaragoza (Post 4054607)
permission type 1 = "-rw-r--r-- 1"

"-" means the file is a regular file

"rw-" means the file's owner can read from and write to the file

"r--" means members of the file's group can read from the file

"r--" means other users can read from the file

"1" means the file has 1 hard link

Quote:

permission type 2 = "drwxr-xr-x 2"
"d" means the file is a directory

"rwx" means the directory's owner can list its contents, create new files within it, and descend into it

"r-x" means members of the directory's group can list its contents and descend into it

"r-x" means other users can list the directory's contents and descend into it

"2" means the directory has 2 hard links

That's the way I understand it. If any of the above is provably wrong then please do correct me.

dcatiii 08-03-2010 05:45 PM

just to further elaborate on telengard's post for educational purposes...

another way to read it can be defined below;

r = 4
w = 2
x = 1

divide the permission in to 3 different groups (User, Group, Everyone Else)

So just to give a clear example, a common permission is 755
which means (User has complete control of the file, Groups can read and execute without modification, Everyone else can read and execute without modification.)


All times are GMT -5. The time now is 03:21 PM.