quartz/content/notes/04-scripting-techniques.md
2023-03-13 13:54:42 +13:00

46 lines
670 B
Markdown

---
title: "04-scripting-techniques"
tags:
- lectures
- cosc301
---
**Least privilege**
- sys admins should follow this principle
- users/proceses should not be given more privileges than they need
- **processes always belong to users**
- e.g.,
- setuid: only when neccesary
- web servers starts as root to open port 80, then switches to a less privileged user
- temporary files shouldn't be in /tmp ⇒ everyone can access tmp, not secure
scripting
- history
- origin
- examples
- shbang
- good tips
bash
I/O and pipe
Env variables and files
interpolation
conditions
- if else
- case
loops
arithmetic
sed and awk
shell script vs c/c++
further reading