Skip to content

File Permissions#

File permissions are how we define who can do what with our data. Without them, creating files and therefore storing information on our systems would be risky. Most file permission concepts are the same across multiple operating systems. Only how we manage them changes, but the idea is usually the same.

There are a few key concepts we need to understand to effectively manage permissions at the operating system level. Let's look at a file listing again using ls -la ~, and we can break down what it is we need to understand to be effective. Here's my listing:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
michael@develop:~$ ls -la ~
total 32
drwxr-xr-x 4 michael michael 4096 Mar 18 10:11 .
drwxr-xr-x 4 root    root    4096 Mar 18 08:01 ..
-rw------- 1 michael michael  312 Mar 18 08:46 .bash_history
-rw-r--r-- 1 michael michael  220 Feb 25  2020 .bash_logout
-rw-r--r-- 1 michael michael 3771 Feb 25  2020 .bashrc
drwx------ 2 michael michael 4096 Mar 18 07:24 .cache
drwxrwxr-x 3 michael michael 4096 Mar 18 09:23 .local
-rw-rw-r-- 1 michael michael    0 Mar 18 10:11 .my_secrets
-rw-r--r-- 1 michael michael  807 Feb 25  2020 .profile
-rw-r--r-- 1 michael michael    0 Mar 18 07:52 .sudo_as_admin_successful

Note

See how I provided ~ at the end of ls -la? Try this: ls -la /home - what's going on here? Simply put, ~ is a shortcut to your user's specific home directory (which doesn't have to be, and may not be, in /home/.)

Each line cam be broken down into a few key components (ignoring some of the fields for now):

  1. The group of permissions: -rw-r--r--
  2. The ownerships of the file or directory: michael michael
  3. The date and time the file (inside of the directory) was last modified: Mar 18 07:52
  4. And the file or directory name: .my_secrets

These are the key concepts we care about the most.

We'll look at each of these concepts, which will use the above file listing to explain and demonstrate how they work.

Key Points#