Adding and Removing Linux Permissions

2016



Granting Permissions
Grant the execute permission to the group.

  ls -l example.py
  -rw-r--r-- 1 pi pi 4452 Jul 25 18:01 example.py
  chmod g+x example.py --- g is for group, x is for execute
  ls -l example.py
  
  -rw-r-xr-- 1 pi pi 4452 Jul 25 18:01 example.py
  The group rights have changed from ----r------ to ----r-x---  (only looking at group, not listed Owner or Other)



If required, more than one permission can be changed at once, for example I want to give write and execute to 'Other'

  ls -l example.py
  -rw-r--r-- 1 pi pi 4452 Jul 25 18:01 example.py
  chmod o+wx example.py --- o is for owner, w is for write, x is for execute
  ls -l example.py
  
  -rw-r--rwx 1 pi pi 4452 Jul 25 18:01 example.py
  The Other rights have changed from --------r-- to -------rwx



Removing permissions
This is the exact opposite, instead of using a + (plus) we use a - (minus)

  ls -l example.py
  -rw-r--rwx 1 pi pi 4452 Jul 25 18:01 example.py
  chmod o-wx example.py --- o is for owner, w is for write, x is for execute
  ls -l example.py
  
  -rw-r--r-- 1 pi pi 4452 Jul 25 18:01 example.py
  The Other rights have changed from --------rwx to -------r--