๐ง 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 + Writer--
Group: Readr--
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
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.