Add lesson 5: Permissions and ownership
3 changed files with 29 additions and 0 deletions
lessons/05-permissions-and-ownership/README.md ADDED
| @@ -0,0 +1,19 @@ | ||
| 1 | +# Lesson 5: Permissions and ownership | |
| 2 | + | |
| 3 | +This lesson covers permissions and ownership. You'll read a short explanation, try three small exercises and finish with a quiz. | |
| 4 | + | |
| 5 | +Full lesson: [https://glibcode.net/courses/linux-shell/lessons/5](https://glibcode.net/courses/linux-shell/lessons/5) | |
| 6 | + | |
| 7 | +## Files | |
| 8 | + | |
| 9 | +- `commands.sh`: chmod, chown and what rwx means | |
| 10 | + | |
| 11 | +## Run it | |
| 12 | + | |
| 13 | +```sh | |
| 14 | +# type the commands from commands.sh one by one; don't run it as a script | |
| 15 | +``` | |
| 16 | + | |
| 17 | +## Exercises | |
| 18 | + | |
| 19 | +See [exercises.md](exercises.md). Ask in the forum once you've tried. | |
lessons/05-permissions-and-ownership/commands.sh ADDED
| @@ -0,0 +1,5 @@ | ||
| 1 | +ls -l script.sh # -rw-r--r-- | |
| 2 | +chmod u+x script.sh # -rwxr--r-- | |
| 3 | +chmod 640 secrets.txt # owner rw, group r, others nothing | |
| 4 | +sudo chown www-data:www-data /var/www/site -R | |
| 5 | +umask | |
lessons/05-permissions-and-ownership/exercises.md ADDED
| @@ -0,0 +1,5 @@ | ||
| 1 | +# Exercises: lesson 5 | |
| 2 | + | |
| 3 | +1. Add a comment above each block explaining what it does, in your own words. | |
| 4 | +2. What happens with an empty input? Change the code so it handles that case with a clear message. | |
| 5 | +3. Explain the example to someone who hasn't taken the course. Which part was hardest to explain? | |