Summer Training Report
Summer Training Report
SUBMITTED BY
Name of student: Isha Rani
Registration Number: 12310584
Signature of the student: Isha Rani
Annexure-II: Student Declaration
To whom so ever it may concern
I, Isha Rani , Registration Number is 12310584, hereby declare that the work done by me
on “RHCSA Summer Training: Mastering Linux System Administration” from10 June 2025 to
18 July 2025, is a record of original work for the partial fulfilment of the requirements for the award
of the degree, Bachelor of Technology Computer Science and Engineering (Cyber Security).
Isha Rani
Dated: 15/08/2025
Training certificate from organization/ Company
Training certificates from Course Platform
I am deeply grateful to my faculty and the institution for the opportunity to take the course in Red Hat
System Administration. With the completion of this course, I have furthered my academic journey and
acquired both theoretical and practical knowledge in Linux system administration.
I am thankful to Red Hat for crafting this well-thought-out and detailed curriculum. The modules on
Linux fundamentals, user and group management, file systems, process monitoring, networking, and
security have greatly enhanced my knowledge of system administration.
With profound gratitude, I thank the instructors for their support, motivation, and wise counsel during
the course. Without their help, completing this project would not have been possible.
list of tables:
o
List of Abbreviations
The primary objective of this project is to design and implement a set of automated scripts that can
simplify routine system administration tasks. System administrators in modern IT infrastructures are
responsible for ensuring that servers, applications, and services run smoothly without interruption.
However, many of the routine tasks such as monitoring disk usage, managing user accounts, tracking
system updates, and detecting abnormal activities consume significant time and effort if done
manually.
Automation addresses this challenge by reducing human intervention and minimizing the chances of
errors. By implementing shell scripts for various administrative tasks, this project aims to:
Automate repetitive activities such as disk monitoring and user session tracking.
Improve system reliability by detecting issues (e.g., zombie processes, suspicious logins)
before they escalate.
Save administrator time and effort, allowing them to focus on critical problem-solving.
Enhance security by monitoring unauthorized access or abnormal device connections.
Provide structured reports (e.g., disk usage via email) to keep administrators updated.
1. Efficiency and Time-Saving – Automated scripts run instantly and on schedule, whereas
manual checks can take hours.
2. Error Reduction – Human errors (e.g., missing a log entry or forgetting to apply updates) are
reduced significantly.
3. Consistency – Tasks such as backups, updates, or monitoring are performed consistently
without variation.
4. Security Enhancement – Automated alerts for suspicious logins or USB device connections
increase the system’s resilience against threats.
5. Scalability – A single administrator can manage hundreds of servers using automation tools
and scripts.
Real-World Example: Large organizations like Google, Amazon, and Microsoft rely heavily on
automation tools such as Ansible, Puppet, Chef, and Bash scripting to maintain thousands of servers
efficiently. Without automation, managing such scale would be nearly impossible.
The scope of this project covers three main areas of system administration:
In real-world IT infrastructures, system administration is one of the most crucial domains. Data
centers, cloud environments, enterprise networks, and even small businesses depend on uninterrupted
IT operations. Failures such as disk overflows, unauthorized logins, or service downtime can result in
heavy financial and reputational losses.
Automation in system administration has become not just an advantage, but a necessity. The scripts
developed in this project are miniature representations of real-world IT solutions, scaled down for
educational purposes. The relevance can be summarized as:
Data Centers: Prevent storage overuse and ensure availability of mission-critical services.
Enterprises: Secure user accounts and monitor suspicious login attempts.
Cloud Platforms: Automate scaling, monitoring, and reporting functions.
SMBs (Small and Medium Businesses): Reduce dependency on dedicated IT staff by
enabling self-monitoring systems.
Thus, the project demonstrates how automation can transform reactive administration into proactive
system management.
The project was carried out following a structured work plan, ensuring that each task was carefully
analyzed, designed, implemented, and tested.
Start
↓
Identify Task → Write Bash Script → Test in Linux → Validate Outputs
↓
Schedule Automation (Cron Jobs) → Generate Reports
↓
Final Integration → Documentation → Completion
↓
End
Chapter 2: DISK AND FILE MANAGEMENT AUTOMATION
Efficient disk and file management is a critical responsibility of system administrators. Without proper
monitoring and maintenance, systems may run out of storage, resulting in crashes, application
downtime, or data corruption. Automating disk-related tasks ensures proactive detection of storage
issues and prevents service disruption.
The goal of this task is to monitor disk usage continuously and alert the system administrator whenever
disk usage exceeds a predefined threshold (e.g., 80%). This prevents storage overflows that could lead
to application or database failures.
Problem Statement:
Manual monitoring of disk space using commands like df -h is time-consuming and prone to human
error. In a production environment, ignoring disk usage can cause:
To resolve this, an automated script can run at regular intervals, check disk space, and send alerts if
usage crosses the threshold.
Implementation Approach:
Explanation of Script
1. Fill the disk with dummy files using dd to simulate low space.
2. Run the script and check if the log entry is generated.
3. Schedule the script with cron:
The objective of this task is to identify files that have not been used or modified for a long period (e.g.,
30 days) and archive them into a compressed file. This helps in freeing disk space and organizing
data without permanently deleting files.
Problem Statement
In large IT environments, logs, temporary files, and unused data keep accumulating.
If these files are not managed:
Manual cleanup is risky because an administrator may delete files still needed by users or applications.
An automated script ensures a systematic and safe archiving process.
Implementation Approach
┌────────────────────┐
│ Start Script │
└───────┬────────────┘
│
┌────────▼───────────┐
│ Scan Target Folder │
└────────┬───────────┘
│
┌────────▼───────────┐
│ Identify Files │
│ Older than 30 Days │
└────────┬───────────┘
│
┌────────▼───────────┐
│ Compress into │
│ Archive (.tar.gz) │
└────────┬───────────┘
│
┌────────▼───────────┐
│ Move to Backup Dir │
└────────┬───────────┘
│
┌────────▼────────┐
│ Delete Original │
│ (Optional) │
└────────┬────────┘
│
┌────────▼────────┐
│ End │
└─────────────────┘
# Directory to scan
TARGET_DIR="/home/user/data"
# Backup location
BACKUP_DIR="/home/user/backup"
# Days threshold
DAYS=30
# Log action
echo "Archived files older than $DAYS days from $TARGET_DIR into $ARCHIVE_NAME at $
(date)" >> /var/log/file_archiver.log
Explanation of Script
find $TARGET_DIR -type f -mtime +$DAYS → Finds files not modified in the last 30 days.
tar -czf → Creates a compressed archive in .tar.gz format.
mkdir -p → Ensures the backup directory exists.
A log entry is created for tracking.
Advantages
The goal of this task is to automatically generate a disk usage report for the system and send it to
the system administrator via email. This ensures proactive monitoring of disk usage before storage
runs out.
Problem Statement
Relying on manual monitoring (using commands like df -h) is unreliable, especially when
managing multiple servers.
Hence, automation ensures regular, timely reporting without manual intervention.
Implementation Approach
# Subject of email
SUBJECT="Disk Usage Report - $(hostname)"
Explanation of Script
Body:
The purpose of this task is to notify system administrators when a user account is about to
expire. This ensures uninterrupted access for legitimate users and prevents unexpected lockouts.
Problem Statement
In enterprise systems, user accounts are often created with an expiry date for:
Temporary employees,
Contractors,
Interns, or
Guest users.
Hence, it is important to automatically notify administrators and/or the users a few days before
account expiration.
Implementation Approach
5 Flowchart
┌────────────────────┐
│ Start Script │
└─────────┬──────────┘
│
┌────────▼────────┐
│ Get User List │
└────────┬────────┘
│
┌────────▼─────────────┐
│ Check Expiry Date │
└────────┬─────────────┘
│
┌─────────▼───────────┐
│ Expiring in < 7 Days?│───No───> End
└─────────┬───────────┘
│Yes
┌─────────▼───────────┐
│ Send Notification │
└─────────┬───────────┘
│
┌─────────▼────────┐
│ End │
└──────────────────┘
Explanation
Body:
Testing
Advantages
Objective
The goal of this task is to log all user login and logout activities.
This ensures that administrators can monitor who accessed the system, at what time, and from
where.
Problem Statement
Thus, a User Session Logger automates the monitoring of all user sessions.
Implementation Approach
1. Use Linux utilities like who, last, and w to capture session info.
2. Extract details: username, login time, logout time, source IP, and TTY.
3. Save details into a log file (e.g., /var/log/user_sessions.log).
4. Schedule script via cron or run as a background daemon.
5. Optionally send alerts for suspicious logins (e.g., odd hours or unknown IP).
6 Flowchart
┌──────────────────────┐
│ Start Script │
└───────────┬──────────┘
│
┌────────▼─────────┐
│ Capture Session │
│ (who / last) │
└────────┬─────────┘
│
┌───────────▼────────────┐
│ Extract User, Time, IP │
└───────────┬────────────┘
│
┌──────────▼─────────────┐
│ Save to Log File │
└──────────┬─────────────┘
│
┌───────────▼───────────┐
│ Check for Suspicious │
│ Logins (Optional) │
└───────────┬───────────┘
│
┌─────────▼─────────┐
│ End │
└───────────────────┘
Testing
Advantages
4.1 Introduction
System security and process monitoring form the backbone of stable IT infrastructure. In modern
computing environments, servers and workstations must not only perform tasks efficiently but also
remain secure, reliable, and continuously monitored. Threats such as unauthorized logins, malicious
device usage, and unmonitored processes can result in system instability, security breaches, or data
loss.
Automation ensures that such risks are minimized by running scripts that constantly monitor the
system, identify irregular activities, and notify administrators in real time.
To identify and report zombie processes in Linux systems, ensuring the process table is not overloaded
and preventing performance issues.
Problem Statement
Implementation Approach
Script
#!/bin/bash
LOGFILE="/var/log/zombie_processes.log"
ADMIN="admin@example.com"
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
if [ -n "$zombies" ]; then
echo "[$timestamp] Zombie processes found:" >> $LOGFILE
echo "$zombies" >> $LOGFILE
echo "-------------------------------------" >> $LOGFILE
6 Comparison Table
Aspect Manual Check Automated
Detector
Effort High Low
Detection Human dependent Instant
Speed
Alerts None Email notification
Scalability Poor Excellent
4.3 Task 7: Suspicious Login Monitor
Objective
To monitor user login activity and detect unauthorized or suspicious login attempts.
Problem Statement
Implementation Approach
8 Flowchart
┌───────────────────┐
│ Start Monitoring │
└─────────┬─────────┘
│
┌───────▼────────┐
│ Read auth logs │
└───────┬────────┘
│
┌───────────▼───────────┐
│ Detect Failed/Invalid │
└───────────┬───────────┘
│
┌───────────▼───────────┐
│ Log Suspicious Events │
└───────────┬───────────┘
│
┌───────────▼───────────┐
│ Alert if > Threshold │
└───────────┬───────────┘
│
┌───────▼───────┐
│ End │
└───────────────┘
Script
#!/bin/bash
LOGFILE="/var/log/suspicious_login.log"
ADMIN="admin@example.com"
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
if [ -n "$suspicious" ]; then
echo "[$timestamp] Suspicious login attempts detected:" >> $LOGFILE
echo "$suspicious" >> $LOGFILE
echo "-------------------------------------" >> $LOGFILE
To detect and alert administrators whenever a new USB storage device is connected to the system.
Problem Statement
Implementation Approach
9 Flowchart
┌─────────────────┐
│ Start Script │
└───────┬─────────┘
│
┌─────────▼────────┐
│ Monitor USB port │
└─────────┬────────┘
│
┌─────────▼─────────┐
│ Detect New Device │
└─────────┬─────────┘
│
┌─────────▼─────────┐
│ Log Device Info │
└─────────┬─────────┘
│
┌─────────▼────────┐
│ Alert Admin │
└──────────────────┘
Script
#!/bin/bash
LOGFILE="/var/log/usb_monitor.log"
ADMIN="admin@example.com"
udevadm monitor --udev | while read line; do
if echo "$line" | grep -q "add.*usb"; then
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
echo "[$timestamp] New USB device connected: $line" >> $LOGFILE
echo "Alert: New USB device connected at $timestamp" \
| mail -s "USB Alert" $ADMIN
fi
done
Sample Log
[2025-08-28 23:15:05] New USB device connected:
/devices/pci0000:00/0000:00:14.0/usb1/1-2
The Zombie Process Detector ensures that orphan processes do not overload the system.
The Suspicious Login Monitor strengthens system security by detecting brute-force or
unauthorized attempts.
The New USB Device Notifier prevents data theft and malware injection through external
devices.
CHAPTER 5: SYSTEM MAINTENANCE AND SERVICE AVAILABILITY
5.1 Introduction
Reliable systems demand both proactive maintenance (keeping software current and clean)
and reactive resilience (self-healing when a critical service fails). In production, update negligence
leads to vulnerabilities, while delayed service restarts cause outages. This chapter operationalizes two
core automations:
Objectives
5.3.2 10 Flowchart
Start
↓
Detect OS/Package Manager
↓
List Available Updates
↓
Any updates?
├─ No → Log "No updates" → End
└─ Yes → Build Report → Log → (Optional) Email/Admin Notify → (Optional) Auto-apply
security → End
#!/usr/bin/env bash
# System Update Tracker
# Supports: Debian/Ubuntu (apt), RHEL-family (dnf/yum)
# Logs: /var/log/system_update_tracker.log
# Optional email via mail/mailx if available
LOGFILE="/var/log/system_update_tracker.log"
REPORT="/tmp/update_report_$(date +%F_%H%M%S).txt"
ADMIN_EMAIL="${ADMIN_EMAIL:-admin@example.com}"
SEND_EMAIL="${SEND_EMAIL:-false}" # set to "true" to send email
AUTO_SECURITY="${AUTO_SECURITY:-false}" # set to "true" to auto-apply security-only
updates (where supported)
detect_pkg_mgr() {
if have_cmd apt; then echo "apt"; return
elif have_cmd dnf; then echo "dnf"; return
elif have_cmd yum; then echo "yum"; return
else
echo "ERROR: No supported package manager found (apt/dnf/yum)." >&2
exit 1
fi
}
list_updates_apt() {
# Avoid interactive prompts
DEBIAN_FRONTEND=noninteractive apt update -y >/dev/null 2>&1 || true
apt list --upgradable 2>/dev/null | grep -v "^Listing..." || true
}
list_updates_dnf() {
dnf check-update -q || true
}
list_updates_yum() {
yum check-update -q || true
}
apply_security_apt() {
# security repo naming can vary; unattended-upgrades is more robust in practice.
if have_cmd unattended-upgrade; then
unattended-upgrade -d --dry-run >/dev/null 2>&1 || true
unattended-upgrade -d || true
else
echo "[WARN] $(timestamp) unattended-upgrades not installed; skipping auto security updates." >>
"$LOGFILE"
fi
}
apply_security_dnf() {
# On many RHEL derivatives, 'dnf update --security' works when metadata is available
dnf -y update --security || true
}
apply_security_yum() {
# Yum has limited security metadata support (requires yum-plugin-security)
if rpm -q yum-plugin-security >/dev/null 2>&1; then
yum -y --security update || true
else
echo "[WARN] $(timestamp) yum-plugin-security not installed; skipping auto security updates." >>
"$LOGFILE"
fi
}
maybe_send_email() {
local subject="$1"
local body_file="$2"
if [[ "$SEND_EMAIL" == "true" ]] && (have_cmd mail || have_cmd mailx); then
(have_cmd mail && mail -s "$subject" "$ADMIN_EMAIL" < "$body_file") || \
(have_cmd mailx && mailx -s "$subject" "$ADMIN_EMAIL" < "$body_file") || \
echo "[WARN] $(timestamp) Failed to send email to $ADMIN_EMAIL" >> "$LOGFILE"
fi
}
main() {
local pmgr; pmgr=$(detect_pkg_mgr)
echo "=== System Update Report @ $(timestamp) ===" > "$REPORT"
echo "Host: $(hostname -f 2>/dev/null || hostname)" >> "$REPORT"
echo "OS Package Manager: $pmgr" >> "$REPORT"
echo "----------------------------------------------" >> "$REPORT"
local updates=""
case "$pmgr" in
apt) updates="$(list_updates_apt)" ;;
dnf) updates="$(list_updates_dnf)" ;;
yum) updates="$(list_updates_yum)" ;;
esac
main "$@"
# 1) Make executable
sudo install -m 0755 system_update_tracker.sh /usr/local/sbin/system_update_tracker.sh
5.4.1 Approach
Monitor DB service health using systemctl and a lightweight connection probe (defensive).
On failure: attempt restart → verify → log → alert (email).
Maintain a rotating log for auditability.
5.4.2 11 Flowchart
Start
↓
Check systemd "active"?
├─ Yes → (Optional) TCP/SQL probe → Healthy → Sleep/Exit
└─ No → Restart service
↓
Verify status
↓
Success? ──── Yes → Log + Notify (info)
└─ No → Log + Notify (critical)
#!/usr/bin/env bash
# Database Service Watchdog (MySQL/MariaDB/PostgreSQL)
# Logs: /var/log/mysql_watchdog.log or /var/log/pgsql_watchdog.log
DB_KIND="${DB_KIND:-mysql}" # mysql|mariadb|pgsql
ADMIN_EMAIL="${ADMIN_EMAIL:-admin@example.com}"
SEND_EMAIL="${SEND_EMAIL:-true}"
LOGFILE=""
SERVICE_NAME=""
probe_pgsql() {
# Requires psql; assumes ident/socket auth for local probe
if have_cmd psql; then
psql -tAc "SELECT 1;" >/dev/null 2>&1 || return 1
else
return 0
fi
}
setup_service() {
case "$DB_KIND" in
mysql|mariadb)
SERVICE_NAME="$(systemctl list-unit-files | awk '/mariadb\.service/ {print "mariadb"}')"
[[ -z "$SERVICE_NAME" ]] && SERVICE_NAME="mysql"
LOGFILE="/var/log/mysql_watchdog.log"
;;
pgsql|postgres|postgresql)
SERVICE_NAME="$(systemctl list-units --type=service --all | awk '/postgresql.*\.service/ {print
$1; exit}')"
[[ -z "$SERVICE_NAME" ]] && SERVICE_NAME="postgresql"
LOGFILE="/var/log/pgsql_watchdog.log"
;;
*)
echo "Unsupported DB_KIND: $DB_KIND (use mysql|mariadb|pgsql)" >&2; exit 1
;;
esac
}
main() {
setup_service
# Post-restart verification
if systemctl is-active --quiet "$SERVICE_NAME"; then
# Re-probe
if [[ "$DB_KIND" =~ ^(mysql|mariadb)$ ]]; then
if probe_mysql; then
notify "DB Restarted" "Service '$SERVICE_NAME' restarted successfully and probe passed."
exit 0
fi
else
if probe_pgsql; then
notify "DB Restarted" "Service '$SERVICE_NAME' restarted successfully and probe passed."
exit 0
fi
fi
fi
notify "DB Critical" "Failed to restore '$SERVICE_NAME' to healthy state. Manual intervention
required."
exit 2
}
main "$@"
[Service]
Type=oneshot
EnvironmentFile=-/etc/db_watchdog.env
ExecStart=/usr/local/sbin/db_service_watchdog.sh
EOF
# Create /etc/systemd/system/db-watchdog.timer
sudo bash -c 'cat >/etc/systemd/system/db-watchdog.timer' <<'EOF'
[Unit]
Description=Run Database Watchdog every 5 minutes
[Timer]
OnBootSec=2min
OnUnitActiveSec=5min
Unit=db-watchdog.service
[Install]
WantedBy=timers.target
EOF
E-commerce peak hour: MySQL crashes under sudden load; the watchdog restarts it within
seconds, auto-notifies admins, and MTTR remains <1 minute—users barely notice.
Patch Tuesday: Update Tracker emails a morning digest of pending security updates; ops
schedules them for 23:00 maintenance, keeping compliance green.
┌─────────────────────────┐
│ Schedule via cron/timer│
└───────────┬─────────────┘
│
┌──────────────────────▼──────────────────────┐
│ Run Update Tracker Script │
└───────────┬─────────────────────┬──────────┘
│ │
Updates? ───┘ └───No → Log ✓
│Yes
▼
Generate Report → Log → (Email) → (Optional Security Auto-Update)
│ (parallel schedule)
▼
┌─────────────────────────┐
│ Run DB Watchdog │
└───────────┬─────────────┘
│
Service Active? ──┴───No → Restart → Verify → Notify
Yes │
▼
Probe SQL → Healthy → Log ✓
5.9 Summary
System Update Tracker standardizes patch hygiene, cutting security exposure and supporting
audits.
Database Service Watchdog keeps critical data services online with self-heal logic and
verifiable logs.
Chapter 6: Conclusion
The project focused on automating essential system administration tasks across areas such as disk
monitoring, user management, system security, and service availability. The table below summarizes
the tasks, their purpose, and the benefit each provides in real-world IT environments:
9 Table:
During the implementation of automation scripts, several important observations were made:
Cron jobs are an effective scheduling mechanism for recurring system tasks.
Logging and reporting are as critical as execution, since administrators need actionable insights
rather than just raw data.
Automation reduces repetitive manual intervention, freeing administrators for higher-level
tasks.
Security automation (e.g., suspicious login monitoring, USB device alerts) provides a first line
of defense against insider threats.
Some tasks (e.g., service watchdogs) require error handling and retry mechanisms to ensure
reliability.
Real-World Relevance:
Data centers, financial institutions, e-commerce platforms, and cloud providers (AWS, Azure, Google
Cloud) heavily rely on automation tools (like Ansible, Puppet, Nagios) to maintain uptime, security,
and efficiency. The tasks developed in this project represent the foundation of such enterprise-level
automation.
While the project successfully implemented 10 critical automation tasks, there is considerable scope
for expansion:
1. Integration with Ansible/Puppet:
Converting shell scripts into Ansible playbooks or Puppet manifests for easier deployment
across large IT infrastructures.
2. Container & Cloud Monitoring:
Extending automation to Docker containers and Kubernetes clusters for modern DevOps
environments.
3. Centralized Dashboard:
Building a web-based dashboard to visualize logs, alerts, and system health in real-time.
4. Advanced Security Enhancements:
Using machine learning models for anomaly detection in login attempts and process
monitoring.
5. CI/CD Pipeline Integration:
Linking update and service watchdog tasks with continuous integration pipelines for
automatic rollback in case of failures.
6.6 Conclusion
In conclusion, this project successfully demonstrated how automation enhances system administration
by improving efficiency, reducing risks, and ensuring service reliability. The tasks implemented
are practical, relevant, and scalable to real-world IT environments.
Through a combination of disk monitoring, user management, security automation, and service
availability, this work provides a foundation for larger-scale enterprise automation systems. The
experience also highlighted the challenges of designing robust scripts and reinforced the importance
of logging, reporting, and proactive monitoring in IT system administration.
7 References
1. A. Frisch, R. S. Bash Cookbook, 1st ed., O'Reilly Media, 2007, pp. 120-155, 300-340.
2. N. Matotek, D. Pro Linux System Administration, 2nd ed., Apress, 2019, pp. 45-88, 601-
650.
3. The Linux Documentation Project: Bash Guide for
Beginners, 2008. https://tldp.org/LDP/Bash-Beginners-Guide/html/ (Accessed on 28th Aug
2025).
4. GNU Operating System: Bash Reference
Manual, 2020. https://www.gnu.org/software/bash/manual/ (Accessed on 28th Aug 2025).
5. Linux man-pages project: cron(8), crontab(5),
systemd.timer(5), 2024. https://man7.org/linux/man-pages/ (Accessed on 28th Aug 2025).
6. Red Hat, Inc.: System Administrator's
Guide, 2023. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/
system_administrators_guide/ (Accessed on 28th Aug 2025).
7. Ubuntu Documentation: Server Guide, 2024. https://ubuntu.com/server/docs (Accessed on
28th Aug 2025).
8. M. K. Loukides in Unix for Advanced Users, (Ed.: A. Oram), O'Reilly Media, 1993, pp. 95–
142.
9. W. Shotts, The Linux Command Line, 5th ed., No Starch Press, 2019, pp. 201-250, 311-370.
10. IBM Documentation: Linux Performance
Monitoring, 2022. https://www.ibm.com/docs/en/linux-on-systems?topic=management-
performance-monitoring (Accessed on 28th Aug 2025).