πŸ” My First Project: Automating Linux Security with Bash Scripts

Anwesa SahuAnwesa Sahu
2 min read

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! 😊


0
Subscribe to my newsletter

Read articles from Anwesa Sahu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anwesa Sahu
Anwesa Sahu