> For the complete documentation index, see [llms.txt](https://cybersecurity-cloud-and-it-notes.gitbook.io/kyles-cybersecurity-cloud-and-it-gitbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cybersecurity-cloud-and-it-notes.gitbook.io/kyles-cybersecurity-cloud-and-it-gitbook/google-cybersecurity-professional-cert/4.-linux-and-sql-tool-of-the-trade/module-3/authenticate-and-authorize-new-users/file-permissions-and-ownership.md).

# File permissions and ownership

Let's make this lesson about **file and directory permissions** in Linux fun and ADHD-friendly with an easy-to-follow breakdown:

***

#### 🎮 **What’s the Deal with Permissions?**

Permissions in Linux = **Who can do what with your files or directories.** Think of it like security access to a top-secret club—you need the right permissions to enter or make changes.

***

#### 🛡️ **3 Types of Permissions in Linux:**

1. **Read (r):** 📖 You can read the file. For directories, you can see what’s inside.
2. **Write (w):** ✍️ You can edit the file. For directories, you can add or remove files.
3. **Execute (x):** 🚀 You can run the file if it’s a program. For directories, you can enter and access files.

***

#### 👥 **Who Gets the Power?**

Permissions apply to **three types of users**:

1. **User** (The owner): You created the file—you’re the boss!
2. **Group** (A team): Anyone in your group (like your squad) gets certain access.
3. **Other** (Everyone else): This is the rest of the system’s users.

***

#### 🕵️ **How Permissions Are Displayed:**

Linux represents file permissions with a **10-character string**. For example: `drwxrwxrwx`.

**Breakdown**:

* The first letter shows the **file type**:
  * `d` = directory
  * `-` = file
* The next nine letters are split into three sets, each showing permissions for **user**, **group**, and **other**:
  * **rwx** = read, write, execute
  * **r--** = read-only

So, `drwxr-xr--` means:

* It’s a directory (`d`)
* The **user** can read, write, and execute
* The **group** can read and execute, but not write
* **Others** can only read

***

#### 🔍 **Checking Permissions:**

To see the permissions for a file or directory, we use the `ls` command with **options** (modifiers to change its behavior).

* **`ls -l`**: Shows detailed info, including permissions.
* **`ls -a`**: Shows **hidden files** (files starting with a dot like `.secretfile`).
* **`ls -la`**: Combines both—shows permissions for all files, including hidden ones!

***

#### 🛠️ **Let’s Try It in Bash!**

1. **See file permissions**:
   * `ls -l`
   * Output: `-rw-r--r--` shows the file **project1.txt** where the **user** can read/write, and **group/others** can only read.
2. **Check hidden files**:
   * `ls -a`
   * You’ll see files like `.hidden1.txt`.
3. **Get everything**:
   * `ls -la`
   * This will show all permissions, including for hidden files.

***

#### 🚨 **Why Permissions Matter:**

Imagine the **payroll department**: You don’t want everyone in the company snooping on salary info! If permissions are set too loosely, sensitive data can be exposed or changed by anyone—**bad news for security**. Make sure permissions are tight, so only those who need access have it.

***

#### 🏆 **Key Takeaways:**

* Linux permissions keep files and directories safe by controlling who can **read, write, and execute**.
* You can check these permissions with `ls -l`, `ls -a`, and `ls -la`.
* **Protect your files** by setting the right permissions for users, groups, and others!

***

Now, take a mini-break before jumping into the next part of your Linux journey! 🌟
