5

What is the ending r for and the leading d for in file permissions on Linux?

Example:

drwxr-xr-x

I know about the user, group, others part, and I know w=write, r=read, x=execute.

But I don't know about the leading d and the trailing r.

Can anyone explain how this works?

3 Answers 3

7
  • d means that the listing is a directory
  • r means the item can be read
  • w means the item can be written to (EG: modified)
  • x means the item can be executed (EG: a script or program)

There are three sets of rwx permissions, which correspond to (in order from left-to-right):

  • the current owner
  • the current group
  • other users
6

The leading d means the entry is a directory; other possibilities include:

I don't know what trailing r you're referring to, there isn't one in your example

2

The hyphens in your examples aren't separators. They're placeholders for where the w's would go, so show that "group" and "others" don't have Write permission.

drwxr-xr-x is read like this: d rwx r-x r-x

d - directory

rwx - user (owner) has Read, Write, and eXecute.

r-x - group has Read and eXecute (but not Write).

r-x - others have Read and eXecute (but not Write).

I think you were misreading the hyphens as separators between the u/g/o sections, like this:

drwxr - xr - x, which would explain why you thought the r's were "trailing".

You must log in to answer this question.