Linux for DevOps: Users, Permissions & Log Analysis (with Practical Tasks + Log File)

Vivek UmraoVivek Umrao
3 min read

Whether you're starting with Linux or diving deeper into DevOps workflows, this guide walks you through real-world, hands-on tasks for managing users, permissions, and analyzing logs β€” all essentials for DevOps engineers.

1️⃣ User & Group Management in Linux πŸ§‘β€πŸ€β€πŸ§‘

Managing users and groups is foundational to Linux security and DevOps automation. Let’s walk through real tasks:

πŸ”§ Task 1: Create a User and Group

bashCopyEditsudo groupadd devops_team
sudo useradd -m -s /bin/bash -g devops_team devops_user
  • -m: creates home directory

  • -s /bin/bash: assigns Bash shell

  • -g: assigns the group

πŸ”‘ Task 2: Set a Password

bashCopyEditsudo passwd devops_user

Choose a secure password β€” it enables SSH login.

πŸ›‘οΈ Task 3: Grant Sudo Access

bashCopyEditsudo usermod -aG sudo devops_user

This gives devops_user administrative (sudo) privileges.

🚫 Task 4: Restrict SSH Login for Certain Users

To block SSH login for specific users (e.g., test users), edit this file:

bashCopyEditsudo nano /etc/ssh/sshd_config

Add at the bottom:

bashCopyEditDenyUsers testuser guest

Then restart the SSH service:

bashCopyEditsudo systemctl restart ssh

βœ… Tip: Use id username or groups username to verify assignments.


2️⃣ File & Directory Permissions πŸ“‚

Understanding permissions helps secure your files and maintain correct access levels across DevOps teams.

πŸ“ Task: Create Workspace and File

bashCopyEditmkdir /devops_workspace
touch /devops_workspace/project_notes.txt

πŸ” Set Custom Permissions:

Owner: edit (read/write)
Group: read only
Others: no access

bashCopyEditchmod 640 /devops_workspace/project_notes.txt

πŸ” Verify:

bashCopyEditls -l /devops_workspace/

Expected output:

bashCopyEdit-rw-r----- 1 devops_user devops_team 0 Jul 10 14:20 project_notes.txt

πŸ“Š Bonus: Permission Truth Table

PermissionBinaryMeaning
7111rwx (full access)
6110rw- (read/write)
5101r-x (read/execute)
4100r-- (read only)
2010-w- (write only)
0000--- (no access)

Use this to understand what chmod 640 really means:

  • 6 (rw-) β†’ Owner

  • 4 (r--) β†’ Group

  • 0 (---) β†’ Others


3️⃣ Log File Analysis with awk, grep, and sed πŸ“„

In DevOps, analyzing logs is πŸ”‘ to troubleshooting and alerting.

πŸ”— Log File for Practice

Since many servers don’t have enough logs, I used this test log file:
πŸ“ Download Linux_2k.log

πŸ› οΈ Task 1: Find Errors Using grep

bashCopyEditgrep -i error Linux_2k.log
  • -i: ignore case

  • Shows all lines containing "error"

🧠 Task 2: Extract Timestamps and Log Levels with awk

bashCopyEditawk '{print $1, $2, $3, $6}' Linux_2k.log
  • This extracts date + log level (assuming the format fits this pattern)

πŸ•΅οΈ Task 3: Replace All IPs with [REDACTED] Using sed

bashCopyEditsed -E 's/([0-9]{1,3}\.){3}[0-9]{1,3}/[REDACTED]/g' Linux_2k.log
  • Hides all IPs for privacy and security β€” useful for public demos/log sharing.

πŸ’¬ Let’s Talk!

I just completed these tasks myself β€” if you're a beginner or DevOps learner, give these a try!

  • What command did you find most useful?

  • Want me to post a script that automates this entire setup?

  • Have your own favorite awk or sed trick? Share it below ⬇️


🧠 Final Tip: Learn by Doing

Even basic commands like chmod, awk, and groupadd are incredibly powerful when applied in real-world setups.

Stay consistent, explore logs, write shell scripts, and you'll be automating your infrastructure in no time πŸ’₯


πŸ™Œ Want More?

I’m planning a Part 2 on:

  • Volumes

Follow me on Hashnode or connect on LinkedIn to get it first!

0
Subscribe to my newsletter

Read articles from Vivek Umrao directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vivek Umrao
Vivek Umrao