Permissions are confusing, and it’s hard to find proper information on them (no need to chmod 0777 anything). We’ll cover how all of this works.


We have three “actors” that can perform operations on a file or directory:




Files (including symlinks and unix sockets), directories, and proceses all have an assigned user and group.


Users, groups, and anyone else (“other”) have specific things they can do to a file or directory. These are the three permissions a user/group/other can do on a file/directory:

read (r)

write (w)

execute (x)


Read is the ability to read the contents of a file, including open in an editor in a read-only format

Write is the ability to modify or delete a file

Execute is the ability to run the file as a program (e.g. a shell script, python script, php script)


Read is the ability to investigate a directory (ls -lah)

Write is the ability to add to a directory, or delete the directory

Execute is the ability to cd into directory

-rwx-rw-r — — A file. U: rwx, G: rw, O: r

drwx-rwx-r-x — A directory. U: rwx, G rwx, O: rx

Changing Ownership / Permissions

We can change ownership of files:

chown [-R] user /path

chown [-R] user:group /path

chown [-R] user: /path

The -R flag is to change files recursively. There is also the chgrp command to change the group of a file/directory.

We can change permissions of a file/directory with chmod :

chmod [-R] u=rwx,g=rw,o=r /path

chmod [-R] u+x,g+wx,o-w /path

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store