Imagine you're managing a Linux-based production server and need to ensure that users, logs, and processes are well-managed. You will perform real-world tasks such as log analysis, volume management, and automation to enhance your DevOps skills.
📌 Tasks
1️⃣ User & Group Management
Learn about Linux users, groups, and permissions (
/etc/passwd
,/etc/group
).Task:
Create a user
devops_user
and add them to a groupdevops_team
.Set a password and grant sudo access.
Restrict SSH login for certain users in /etc/ssh/sshd_config
.
Answer : Run following command
- Create devops_user
- Create group devops_team
3.Add User devops_user to Group Devops_team
- Set Password for devops_user
- Set Password to groups
Grant sudo access to user and group
Edit Visudo file
Check grand sudo access to user
- restrict ssh user to login
2️⃣ File & Directory Permissions
3️⃣ Log File Analysis with AWK, Grep & Sed
Logs are crucial in DevOps! You’ll analyze logs using the Linux_2k.log file from LogHub (GitHub Repo).
Task:
Download the log file from the repository.
Extract insights using commands:
Use
grep
to find all occurrences of the word "error".Use
awk
to extract timestamps and log levels.Use
sed
to replace all IP addresses with [REDACTED] for security.
Bonus: Find the most frequent log entry using awk
or sort | uniq -c | sort -nr | head -10
.
4️⃣ Volume Management & Disk Usage
Task:
Create a directory
/mnt/devops_data
.Mount a new volume (or loop device for local practice).
Verify using df -h
and mount | grep devops_data
.
5️⃣ Process Management & Monitoring
Task:
Start a background process (
ping
google.com
> ping_test.log &
).Use
ps
,top
, andhtop
to monitor it.
Kill the process and verify it's gone.
6️⃣ Automate Backups with Shell Scripting
Task:
Write a shell script to back up
/devops_workspace
asbackup_$(date +%F).tar.gz
.Save it in
/backups
and schedule it usingcron
.Make the script display a success message in green text using
echo -e
.