๐Ÿง  Mastering Linux Administration: A Step-by-Step Hands-on Lab Guide

๐Ÿ” 1. User & Group Management

๐Ÿ”Ž What are Linux users, groups, and permissions?

Users:

  • Linux is a multi-user OS.

  • User types:

    • Root User: Full system access.

    • System Users: Services and daemons.

    • Regular Users: Human users.

Groups:

  • A group gives a set of users shared permissions.

  • Example: developers can modify code, marketing can only read docs.

Permissions Example:

-rw-r--r-- 1 user1 user1 48 Feb 5 10:00 file.txt
  • rw- Owner: Read + Write

  • r-- Group: Read

  • r-- Others: Read

Modify Permissions:

chmod 764 file.txt
  • 7 = Owner (rwx), 6 = Group (rw-), 4 = Others (r--)

๐Ÿงช Task 1: Create user and group

sudo useradd -m devops_user -s /bin/bash
sudo groupadd devops_team
sudo gpasswd -M devops_user devops_team
cat /etc/group

๐Ÿงช Task 2: Set password and give sudo access

sudo passwd devops_user
sudo usermod -aG sudo devops_user
cat /etc/group

๐Ÿงช Task 3: Restrict SSH login

Edit file:

sudo vim /etc/ssh/sshd_config

Add:

DenyUsers user1 user2
DenyGroup devops_team

Restart SSH:

sudo systemctl restart sshd

๐Ÿ“ 2. File & Directory Permissions

๐Ÿงช Task 1: Create directory and file

sudo mkdir devops_workspace
cd devops_workspace
sudo touch project_note.txt

๐Ÿงช Task 2: Set permissions

sudo chmod 740 project_note.txt
ls -l
  • Owner: read/write

  • Group: read

  • Others: no access


๐Ÿ“„ 3. Log File Analysis (AWK, GREP, SED)

๐Ÿ” grep: Find "authentication failure"

grep -i "authentication failure" app.log

๐Ÿงฎ awk: Extract timestamps and fields

awk '/authentication failure/ {print $1, $2, $3, $7}' app.log | head
awk '/authentication failure/ {print $1, $2, $3, $7}' app.log | tail

๐Ÿ›  sed: Mask IPs

sed -E "s/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[0-9a-fA-F:]+:[0-9a-fA-F:]+)/[REDACTED]/g" auth_fail_ips.txt

๐Ÿ” Unique entries

sed "s/rhost/IP/g" auth_fail_ips.txt | uniq

๐Ÿ’ฝ 4. Volume Management & Disk Usage

๐Ÿงช Task 1: Setup volume and LVM

mkdir -p /mnt/devops_data

Volume Management complete video : https://www.youtube.com/watch?v=Evnf2AAt7FQ
Create volumes in AWS Console (same region/zone as EC2).Attach to instance as /dev/sdf.

Check block devices:

lsblk

Create physical volumes:

sudo su
pvcreate /dev/xvdf /dev/xvdg

Create volume group:

vgcreate tws_vg /dev/xvdf /dev/xvdg

Create logical volume:

vcreate -L 1.5G -n tws_lv tws_vg

๐Ÿงช Task 2: Format and mount

mkfs.ext4 /dev/tws_vg/tws_lv
mount /dev/tws_vg/tws_lv /mnt/devops_data/

๐Ÿงช Task 3: Verify volume

df -h | grep devops_data

๐Ÿ–ฅ 5. Process Management & Monitoring

๐Ÿงช Task 1: Start a background process

ping google.com > ping_test.log &

๐Ÿงช Task 2: Monitor process

ps aux | grep ping
top
htop   # Install with: sudo apt install htop

๐Ÿงช Task 3: Kill process

ps aux | grep ping
kill <PID>

โœ… Final Thoughts

Understanding Linux user/group management, permissions, log parsing, disk volumes, and process monitoring is essential for any DevOps or system admin professional. This hands-on guide helps build practical confidence to manage real-world Linux systems efficiently and securely.

Happy Learning! ๐Ÿš€

#Linux #DevOps #System Administration #AWS #Volume Management #Monitoring

0
Subscribe to my newsletter

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

Written by

Pratik Prajapati
Pratik Prajapati

๐Ÿ‘‹ Welcome to my Hashnode blog! I'm a Web developer with 7 year's of experience and now I am going to change my domain as DevOps Engineer with lots of hands on experience.