Linux Challenge Riyan
Linux Challenge Riyan
The objective of this challenge is to assess the students' ability to manage a Linux
environment effectively, write shell scripts, and perform system administration tasks. They
should be able to demonstrate their understanding of Linux file system hierarchy, user
management, process management, networking, and automation.
Challenge Tasks:
Beginner Level
1. Create Users:
o Create a new user named student1.
o Set a password for student1.
2. Groups:
o Create a new group named devops.
o Add student1 to the devops group.
3. User Permissions:
o Ensure that the project directory is accessible to members of the devops
group.
4. Disk Usage:
o Display disk usage in human-readable format for /home directory and save the
output to a file named disk_usage.txt.
Intermediate Level
1. List Processes:
o Display all running processes and redirect the output to a file named
process_list.txt.
2. Background Process:
o Start a simple background process that writes the current date and time to a
file named timestamp.txt every minute using a while loop and sleep.
3. Kill Process:
o Find the process ID (PID) of the background process started in the previous
step and terminate it.
4. CPU and Memory Usage:
o Display the current CPU and memory usage using top or htop, save a
snapshot of this information to a file named cpu_mem_usage.txt.
Task 4: Networking
1. Network Configuration:
o Display the current network configuration using ifconfig or ip addr.
2. Ping Test:
o Ping google.com and save the output to a file named ping_results.txt.
3. Open Ports:
o List all open ports on the system using netstat or ss command.
4. Firewall Configuration:
o Check if the ufw (Uncomplicated Firewall) is installed and running. If not,
install and enable it.
o Allow incoming connections on port 80 (HTTP) and 443 (HTTPS).
1. Backup Script:
o Write a shell script named backup.sh that compresses the project directory
into a tar.gz file and saves it in the /home/devops/academy/backup directory.
The script should include error handling to ensure the backup only proceeds if
the project directory exists.
2. Automation Script:
o Create a script named cleanup.sh that deletes all files in the
/home/devops/academy/backup directory that are older than 7 days.
Schedule this script to run daily using cron.
3. Log Rotation:
o Write a script named rotate_logs.sh to rotate the timestamp.txt file if it
exceeds 1MB in size and save old logs with a timestamp in the filename.
o
Advanced Level: