Files
Midori-Obsidian/Midori's Linux Dojo 🌸/Phase 3 - Users and Files/Exercises.md
2026-05-22 02:17:18 +02:00

83 lines
1.3 KiB
Markdown

# 🧰 Phase 3: Users and Files
> Goal: Who can do what — users, groups, permissions, processes
---
## 🎯 Exercise 1 — User Management
```bash
# Create users
useradd -m bob
passwd bob # Set a password
# Check user info
id bob
cat /etc/passwd | grep bob
# Groups
groupadd developers
usermod -aG developers bob
groups bob
# Switch user
su - bob
whoami
exit
```
---
## 🎯 Exercise 2 — File Ownership
```bash
# Create file as root, give to bob
touch /root/lab/team-project.txt
chown bob:developers /root/lab/team-project.txt
ls -la /root/lab/team-project.txt
# Set permissions
chmod 640 /root/lab/team-project.txt
```
---
## 🎯 Exercise 3 — Sudo / Doas
```bash
# Give bob sudo access
echo "bob ALL=(ALL) ALL" >> /etc/sudoers
# OR on Alpine (doas):
echo "permit persist bob" >> /etc/doas.d/doas.conf
```
---
## 🎯 Exercise 4 — Processes
```bash
# View processes
ps aux
ps -ef
top # Press 'q' to quit
# Background jobs
sleep 100 &
jobs
kill %1
# Service management (Alpine)
rc-service sshd status
rc-update show
```
---
## ✅ Phase 3 Checklist
- [ ] Create users and groups
- [ ] File ownership and permissions
- [ ] Sudo/doas configuration
- [ ] Process management
**Previous:** [[Phase 2 - Networking]] | **Next:** [[Phase 4 - Security]]