Linux Permissions Introduction

2016

For someone like me who comes from a Windows background, Linux permissions were somewhat confusing, so here is a little reminder because from time to time, I do forget (okay, all the time).
First the structure, I have an example file that I will use, to show this file and its permissions, from a command line enter:

ls -al
The output is:
"-rw-r--r-- 1 pi pi 4452 Jul 25 18:01 example.py"

The part we are interest in is at the start of the line:

"-rw-r--r--"
A 10 character section that can be split up as:
"-" This denotes file or directory "-" = File, "d" = Directory

Then we have three sets of three characters, and these are the different permissions for:

"rw-" - Owner
"r--" - Group
"r--" - Other

Remember:

r is for read, w is for write and x is for execute.

So for our example:

"-rw-r--r-- 1 pi pi 4452 Jul 25 18:01 example.py"
"-" means its a file
"rw-" Owner has read + write permissions
"r--" Group has read only
"r--" Other has read only.

Who is the Owner and Group?

"-rw-r--r-- 1 pi pi 4452 Jul 25 18:01 example.py"
In this example, pi is the owner and they are a member of the pi group