# Access Rights

* Every user has a unique username and is member of 1+ groups.
* Every file and directory has a owner, a group and a set of permission flags.
* Flags specify permissions:
  * read, write and execute(rwx)
  * owner, group and others (ugo).
* Programs need to have execute (x) permission to run in shell

```
ls -lt
```

<figure><img src="/files/jTTLvlqMv5cVrxxgxTlE" alt=""><figcaption></figcaption></figure>

#### Permissions are controlled with the commands chmod, chown, chgrp

* Only owner can change permissions of a file

#### chmod

* chmod has 2 different syntaxes

**Syntax 1**

* assign (=), gives(+), or take away(-) permission
* who corresponds to --> u (user), g (group), o (other)
* permission corresponds to --> read (r), write (w), execute (x)
  * chmod who=permission
  * chmod who+permission
  * chmod who-permission

```
 ls -l catfile.txt
 chmod g=rwx catfile.txt
 ls -l catfile.txt
```

```
 ls -l catfile.txt
 chmod g-w catfile.txt
 ls -l catfile.txt
```

```
 ls -l catfile.txt
 chmod o+x catfile.txt
 ls -l catfile.txt
```

<figure><img src="/files/lii0FGyYjPZzQ70gAAXt" alt=""><figcaption></figcaption></figure>

**chmod n**

* numeric shortcuts to change mode in a compact way.
* format: chmod n filename
  * n is a 3 digit number, values from 0 to 7
  * each digit is associated to user, group, other

<figure><img src="/files/IlKAeeqrkzzM0Xxw2RLs" alt=""><figcaption></figcaption></figure>

* examples:

```
ls -l catfile.txt
chmod 644 catfile.txt
ls -l catfile.txt
chmod 700 catfile.txt
ls -l catfile.txt
```

<figure><img src="/files/7e4PMQhYjVi0C64MFe29" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://igb.mit.edu/mini-courses/introduction-to-unix-and-ki-computational-resources/basic-unix/access-rights.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
