π My First Project: Automating Linux Security with Bash Scripts

As someone just starting out in the world of cybersecurity and Linux administration, I wanted to build something practical that also challenged me to learn. So I created my first-ever project: a set of Bash scripts that automate the process of securing Ubuntu-based Linux systems.
In this post, Iβll walk you through what the project does, how I built it, and what I learned in the process.
π What Inspired This Project?
When working with Linux systems, especially servers, securing them is one of the most important tasks. But doing it manually every time can be repetitive and error-prone.
So I thought β why not automate it?
This idea led me to build a collection of Bash scripts that make it easy to apply basic security hardening on a fresh Ubuntu installation.
π οΈ What the Project Does
Hereβs a breakdown of the functionality:
1. Disable Root Login via SSH
Root login is risky. The script edits /etc/ssh/sshd_config
to disable root access over SSH, then restarts the SSH service.
2. (Optional) Enable Root Login
A separate script allows you to safely re-enable root login if needed.
3. Install and Configure UFW
UFW (Uncomplicated Firewall) is installed, and default rules are set to deny incoming and allow outgoing traffic. SSH access is explicitly allowed.
4. Auto-Update System
A script that runs apt update && apt upgrade -y
to keep your system up to date.
5. Create Secure User Accounts
Creates new users with sudo access and a secure password β perfect for least-privilege setups.
π§ What I Learned
This project helped me get hands-on experience with:
π₯οΈ Bash scripting
π‘οΈ Linux server hardening practices
π User account security
π Understanding how SSH and UFW are configured
π Project Structure
linux-secure-scripts/
βββ disable-root-ssh.sh # Disable root SSH access
βββ enable-root-ssh.sh # Enable root SSH access (optional)
βββ enable-ufw.sh # Configure UFW firewall
βββ auto-update.sh # Automate package updates
βββ create-user.sh # Add new sudo user
βββ README.md
π GitHub Repository
You can find the full code, installation steps, and usage instructions on GitHub:
π https://github.com/Anwesa-s/linux-secure-scripts
π Final Thoughts
This was a small but impactful first project. It helped me understand how real-world Linux systems can be secured using simple automation.
If you're just starting out like me, try building something hands-on. Itβs the best way to learn β and it's rewarding to see your scripts make real changes on a system!
Thank you for reading! π
Subscribe to my newsletter
Read articles from Anwesa Sahu directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
