When running ls -al, the beginning of the output starts with something like drwxrwxr-x In this string I understand the following:

  • d --> At the beginning of the string means directory
  • r --> Means read permissions
  • w --> Means Write permissions
  • x --> And the x means execute permissions

What I am confused about though, is why does the rwx repeat multiple times throughout this string drwxrwxr-x??? I believe it has something to do with current user permissions, group permissions, and something else.... Any advice or knowledge would be greatly appreciated...

  • 3
    owner, group, others – guiverc Nov 16 '17 at 21:59
  • What is the environment others? – NerdOfCode Nov 16 '17 at 21:59
  • 2
    others means everyone else (not the owner, not in group) – guiverc Nov 16 '17 at 22:00
  • So in my particular case drwxrwxr-x, the other category only has read and execute permissions??? – NerdOfCode Nov 16 '17 at 22:03
  • yes, that is what it means. – Andrew Shum Nov 16 '17 at 22:04

You are correct. The first set pertains to the owner, the second to the owner group, and the third to everyone else. By default, each user has their own user group. When a user creates a file, they are set as the owner and their user group is set as the owner group. Note that these are set according to effective user. Therefore, if you create something while you have elevated privileges (ex. using sudo) the owner will be the user root and the owner group will be the group root. Users can be added to user groups and ownership can be changed using chown.

Some recognition for @guiverc who posted in the comments while I was writting my answer.

  • So you're saying that if I created a file using touch the account I created the file with is the owner and they have their own user group? – NerdOfCode Nov 16 '17 at 22:05
  • yes, those are the default values for the owner and group. – Andrew Shum Nov 16 '17 at 22:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.