Foundations

Files and permissions

20 min

Every file has an owner, a group and three sets of permissions: for the owner, for the group and for everyone else.

Reading the list

-rwxr-xr-- 1 sara dev 220 Jan 1 run.sh

The first letter is the type. Then come three triplets: rwx for the owner, r-x for the group, r-- for everyone else. r is read, w is write, x is run.

Changing them

  • chmod +x run.sh lets the owner run the file
  • chmod 640 notes.txt gives the owner read and write, the group read, others nothing

Try it

Create a file, remove its read permission with chmod -r file, and watch cat refuse. Then give it back.