Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
digitalnewsservices.com
digitalnewsservices.com
  • Home
  • Linux
  • Git
  • Docker
  • Jenkins
  • Kubernetes
  • DevOps Projects
  • Home
  • Blog
  • Home
  • Linux
  • Git
  • Docker
  • Jenkins
  • Kubernetes
  • DevOps Projects
  • Home
  • Blog
Close

Search

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
digitalnewsservices.com
digitalnewsservices.com
  • Home
  • Linux
  • Git
  • Docker
  • Jenkins
  • Kubernetes
  • DevOps Projects
  • Home
  • Blog
  • Home
  • Linux
  • Git
  • Docker
  • Jenkins
  • Kubernetes
  • DevOps Projects
  • Home
  • Blog
Close

Search

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
Home/Linux/Linux Users, Groups & Permissions
Linux

Linux Users, Groups & Permissions

By Sumit Sharma
April 19, 2026 3 Min Read
0

DevOps Level Mastery: Protecting Your Production Infrastructure

CHAPTER 4: SECURITY & ACCESS

Linux Users, Groups & Permissions

DevOps Level Mastery: Protecting Your Production Infrastructure

1. Introduction (ELI5)

Imagine an office building. The CEO has the master key (Root), Employees have access to their desks (Normal Users), and Teams share common cabins (Groups).
Maan lijiye Linux ek office building hai. CEO (Root) ke paas master key hai, Employees (Normal Users) sirf apni desk use kar sakte hain, aur Teams (Groups) common cabins share karte hain.

In DevOps, we follow the Principle of Least Privilege—yani kisi ko utna hi access do jitna kaam ke liye zaroori ho!

2. Deep Dive Concepts

What is a User?

A user is an account that can own files and run tasks. Linux identifies users by a unique number called UID.

  • Root User (UID 0): The “God Mode”. Yeh system mein kuch bhi kar sakta hai.
  • Normal User (UID 1000+): Regular users like sumit_dev or jenkins. Unka access limited hota hai.

What are Groups?

Groups are collection of users. DevOps mein hum 50 developers ko individually permission nahi dete, hum unhe ek dev-team group mein daal dete hain aur group ko permission dete hain.

File Ownership & Permissions (r, w, x)

Every file has three owners: User, Group, and Others. Every owner has three permissions: Read(4), Write(2), and Execute(1).
Har file ke teen level par permission hoti hai: User (u), Group (g), aur Others (o). Inke pass 3 powers hoti hain: Read, Write aur Execute.

3. Commands Toolbox 🛠️

Add a new User:

sudo useradd -m dev_sumit
# Ye command naya user aur uska home directory banata hai.

Change Password:

sudo passwd dev_sumit
# User ka password set karne ke liye.

Change Permissions (chmod):

chmod 755 deploy.sh
# Owner=Full(7), Group=Read/Exec(5), Others=Read/Exec(5).

Change Ownership (chown):

sudo chown sumit:dev-team project.txt
# File ka owner sumit aur group dev-team set karta hai.

4. Real-World DevOps Scenarios (10-12 Examples)

1. Developer ko sirf Read access dena
Situation: Sensitive config file hai.
chmod 400 config.yaml
Result: Only owner can read, baaki sab blocked.
2. Script ko Run (Execute) karne layak banana
Situation: Aapne backup.sh script likhi hai.
chmod +x backup.sh
Result: Ab ise ./backup.sh se run kiya ja sakta hai.
3. SSH Private Key secure karna
Situation: Key file permissions agar 777 hui toh Linux login block kar dega.
chmod 600 my_key.pem
Result: Highly secure. Real DevOps me ye har roz use hota hai.
4. Log files protect karna
Situation: Log files delete nahi honi chahiye.
chmod 444 app.log
Result: Read-only for everyone.
5. Tester ko execute access dena
Situation: Tester ko automation suite run karna hai.
chmod g+x automation_test.py
Result: Tester group wale use run kar payenge.
6. Shared Folder access for Team
chmod 770 /mnt/shared_data
Result: Sirf Owner aur Group full kaam kar sakte hain, Others blocked.

…and many more scenarios like Deployment user setup (giving specific sudo rights) and Restricting sensitive files in Production.

🚀 Project 1: Secure Web Server Access

Scenario: Web server folder /var/www/html ko secure karna hai taaki sirf web-devs group kaam kare.

sudo groupadd web-devs
sudo usermod -aG web-devs amit_dev
sudo chown -R root:web-devs /var/www/html
sudo chmod -R 775 /var/www/html

Result: Web developers code upload kar payenge, par public sirf website dekh payegi (Read access).

🚀 Project 2: Multi-User Production Server

Scenario: Server par 3 roles: Admin, Developer, aur Tester.

  • Admin: sudo usermod -aG sudo admin_user (Full Power)
  • Dev: chmod 750 /apps/code (Read/Exec for code)
  • Tester: chmod 550 /apps/tests (Execution only)

Summary (Key Takeaways) 🎯

  • Root (UID 0) is the King. Use it wisely.
  • 4-2-1 rule: 4=Read, 2=Write, 1=Execute.
  • chmod badalta hai *Kya* kar sakte hain (Permissions).
  • chown badalta hai *Kaun* kar sakta hai (Ownership).
  • DevOps Mantra: Kabhi bhi file ko 777 permission mat do production mein! ⚠️
Author

Sumit Sharma

Follow Me
Other Articles
Previous

Linux File System Challenge — Can You Prove Your DevOps Skills? Most learners fail this challenge on their first attempt.

Next

Quiz

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Dockerfile — Build Production-Ready Images Like a DevOps Engineer
  • Docker Images & Containers
  • Docker Introduction — Learn Containers with Real DevOps Projects (Beginner to Advanced)
  • Git Branching & Team Collaboration — Work Like a Real DevOps Engineer
  • Remote Repositories & Cloud Workflow

Recent Comments

No comments to show.

Archives

  • April 2026

Categories

  • Docker
  • Git
  • Linux
  • Uncategorized
Copyright 2026 — digitalnewsservices.com. All rights reserved. Blogsy WordPress Theme