Skip to content

Commit 68e1bfe

Browse files
Added day 11 tasks
1 parent 129f26e commit 68e1bfe

File tree

1 file changed

+216
-0
lines changed

1 file changed

+216
-0
lines changed

2026/day-11/README.md

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# Day 11 – File Ownership Challenge (chown & chgrp)
2+
3+
## Task
4+
Master file and directory ownership in Linux.
5+
6+
- Understand file ownership (user and group)
7+
- Change file owner using `chown`
8+
- Change file group using `chgrp`
9+
- Apply ownership changes recursively
10+
11+
---
12+
13+
## Expected Output
14+
- A markdown file: `day-11-file-ownership.md`
15+
- Screenshots showing ownership changes
16+
17+
---
18+
19+
## Challenge Tasks
20+
21+
### Task 1: Understanding Ownership (10 minutes)
22+
23+
1. Run `ls -l` in your home directory
24+
2. Identify the **owner** and **group** columns
25+
3. Check who owns your files
26+
27+
**Format:** `-rw-r--r-- 1 owner group size date filename`
28+
29+
Document: What's the difference between owner and group?
30+
31+
---
32+
33+
### Task 2: Basic chown Operations (20 minutes)
34+
35+
1. Create file `devops-file.txt`
36+
2. Check current owner: `ls -l devops-file.txt`
37+
3. Change owner to `tokyo` (create user if needed)
38+
4. Change owner to `berlin`
39+
5. Verify the changes
40+
41+
**Try:**
42+
```bash
43+
sudo chown tokyo devops-file.txt
44+
```
45+
46+
---
47+
48+
### Task 3: Basic chgrp Operations (15 minutes)
49+
50+
1. Create file `team-notes.txt`
51+
2. Check current group: `ls -l team-notes.txt`
52+
3. Create group: `sudo groupadd heist-team`
53+
4. Change file group to `heist-team`
54+
5. Verify the change
55+
56+
---
57+
58+
### Task 4: Combined Owner & Group Change (15 minutes)
59+
60+
Using `chown` you can change both owner and group together:
61+
62+
1. Create file `project-config.yaml`
63+
2. Change owner to `professor` AND group to `heist-team` (one command)
64+
3. Create directory `app-logs/`
65+
4. Change its owner to `berlin` and group to `heist-team`
66+
67+
**Syntax:** `sudo chown owner:group filename`
68+
69+
---
70+
71+
### Task 5: Recursive Ownership (20 minutes)
72+
73+
1. Create directory structure:
74+
```
75+
mkdir -p heist-project/vault
76+
mkdir -p heist-project/plans
77+
touch heist-project/vault/gold.txt
78+
touch heist-project/plans/strategy.conf
79+
```
80+
81+
2. Create group `planners`: `sudo groupadd planners`
82+
83+
3. Change ownership of entire `heist-project/` directory:
84+
- Owner: `professor`
85+
- Group: `planners`
86+
- Use recursive flag (`-R`)
87+
88+
4. Verify all files and subdirectories changed: `ls -lR heist-project/`
89+
90+
---
91+
92+
### Task 6: Practice Challenge (20 minutes)
93+
94+
1. Create users: `tokyo`, `berlin`, `nairobi` (if not already created)
95+
2. Create groups: `vault-team`, `tech-team`
96+
3. Create directory: `bank-heist/`
97+
4. Create 3 files inside:
98+
```
99+
touch bank-heist/access-codes.txt
100+
touch bank-heist/blueprints.pdf
101+
touch bank-heist/escape-plan.txt
102+
```
103+
104+
5. Set different ownership:
105+
- `access-codes.txt` → owner: `tokyo`, group: `vault-team`
106+
- `blueprints.pdf` → owner: `berlin`, group: `tech-team`
107+
- `escape-plan.txt` → owner: `nairobi`, group: `vault-team`
108+
109+
**Verify:** `ls -l bank-heist/`
110+
111+
---
112+
113+
## Key Commands Reference
114+
115+
```bash
116+
# View ownership
117+
ls -l filename
118+
119+
# Change owner only
120+
sudo chown newowner filename
121+
122+
# Change group only
123+
sudo chgrp newgroup filename
124+
125+
# Change both owner and group
126+
sudo chown owner:group filename
127+
128+
# Recursive change (directories)
129+
sudo chown -R owner:group directory/
130+
131+
# Change only group with chown
132+
sudo chown :groupname filename
133+
```
134+
135+
---
136+
137+
## Hints
138+
139+
- Most `chown`/`chgrp` operations need `sudo`
140+
- Use `-R` flag for recursive directory changes
141+
- Always verify with `ls -l` after changes
142+
- User must exist before using in `chown`
143+
- Group must exist before using in `chgrp`/`chown`
144+
145+
---
146+
147+
## Documentation
148+
149+
Create `day-11-file-ownership.md`:
150+
151+
```markdown
152+
# Day 11 Challenge
153+
154+
## Files & Directories Created
155+
[list all files/directories]
156+
157+
## Ownership Changes
158+
[before/after for each file]
159+
160+
Example:
161+
- devops-file.txt: user:user → tokyo:heist-team
162+
163+
## Commands Used
164+
[your commands here]
165+
166+
## What I Learned
167+
[3 key points about file ownership]
168+
```
169+
170+
---
171+
172+
## Troubleshooting
173+
174+
**Permission denied?**
175+
- Use `sudo` for chown/chgrp operations
176+
177+
**Group doesn't exist?**
178+
- Create it first: `sudo groupadd groupname`
179+
180+
**User doesn't exist?**
181+
- Create it first: `sudo useradd username`
182+
183+
---
184+
185+
## Why This Matters for DevOps
186+
187+
In real DevOps scenarios, you need proper file ownership for:
188+
189+
- Application deployments
190+
- Shared team directories
191+
- Container file permissions
192+
- CI/CD pipeline artifacts
193+
- Log file management
194+
195+
---
196+
197+
## Submission
198+
1. Navigate to `2026/day-11/` folder
199+
2. Add `day-11-file-ownership.md` with screenshots
200+
3. Commit and push to your fork
201+
202+
---
203+
204+
## Learn in Public
205+
206+
Share on LinkedIn about mastering file ownership.
207+
208+
Use hashtags:
209+
```
210+
#90DaysOfDevOps
211+
#DevOpsKaJosh
212+
#TrainWithShubham
213+
```
214+
215+
Happy Learning
216+
**TrainWithShubham**

0 commit comments

Comments
 (0)