Linux File Ownership: Understanding Access Control

Day 11 of #90DaysOfDevOps 🚀 Linux File Ownership: The Other Half of Access Control Permissions tell Linux what can be done to a file. Ownership tells Linux who those permissions apply to. Both must be correct. One wrong ownership in prod can break an entire deployment. What I practiced today: → Identified owner and group columns using `ls -l` → Changed file owner with `chown` → Changed file group with `chgrp` → Changed both owner and group in one command → Applied ownership recursively to an entire directory tree → Set different ownership per file across a multi-team project Commands That Matter: ✅ `chown user file` — change user owner only ✅ `chgrp group file` — change group only ✅ `chown user:group file` — change both in one command ✅ `chown -R user:group dir/` — recursive, applies to all files inside ✅ `ls -lR` — verify ownership across entire directory tree 💡 Key Insight: `chown -R` without the `-R` flag only changes the directory itself — not the files inside. Everything looks fine until your app tries to access a file and gets `Permission denied`. Always use `-R` for directories. 🔑 Mindset Shift: Don’t chown files to individual users in shared environments. Assign to a group. Manage membership. That scales. That’s how production teams operate. #90DaysOfDevOps #DevOpsKaJosh #TrainWithShubham #Linux #DevOps #LearningInPublic

To view or add a comment, sign in

Explore content categories