Skip to content
All articles
Feb 14, 20246 min read

Simplifying User Management on Linux with a Bash Script

Managing user accounts and groups on a Linux system is a fundamental task for system administrators. To streamline this process, I've developed a user management script in Bash, providing a simple yet powerful tool for efficiently handling user-related operations. In this article, we'll explore the features, usage, and benefits of this script.


The Need for an Efficient User Management Solution

As systems grow and more users are added, handling user accounts becomes increasingly complex. A robust user management system is essential for maintaining security, ensuring proper access controls, and facilitating the overall administration of a Linux environment. The usermanagement script addresses these needs by offering a set of intuitive and versatile options.


#!/bin/bash


# User Account Management Script

# Function to display usage information
display_usage() {
    echo "Usage: $0 [options]"echo "Options:"echo "  -c, --create   Create a new user account."echo "  -cg, --create_group   Create a new group."echo "  -lg, --list_group   List all users on the group."echo "  -mg, --modify_group   Add multiple users in a group."echo "  -d, --delete   Delete an existing user account."echo "  -r, --reset    Reset the password of an existing user account."echo "  -m, --modify   Modify a user group."echo "  -l, --list     List all user accounts on the system."echo "  -h, --help     Display this help message."
}


# Function to create a new user account
create_user() {
    read -p "Enter the new username: " username


    # Check if the username already existsif id "$username" &>/dev/null; thenecho "Error: Username '$username' already exists. Please choose a different username."exit 1
    fi


    # Prompt for passwordread -s -p "Enter the password: " password
    echo -e "\n"


    # Create the user
    sudo useradd -m -p "$(openssl passwd -1 "$password")" "$username"


    echo "Success: User '$username' created."
}


# Function to modify a user account
modify_user() {
    read -p "Enter the group name: " group
    read -p "Enter the new username: " username


    # Check if the username already existsif id "$username" &>/dev/null; then# Check if the user is already in the specified groupif groups "$username" | grep -q "\<$group\>"; thenecho "Error: User '$username' is already in the '$group' group."exit 1
        fielseecho "Error: User '$username' does not exist."exit 1
    fi


    # Update the user group
    sudo usermod -aG "$group" "$username"


    echo "Success: User '$username' added to the '$group' group."
}


# Function to delete an existing user account
delete_user() {
    read -p "Enter the username to delete: " username


    # Check if the username existsif id "$username" &>/dev/null; then
        sudo userdel -r "$username"echo "Success: User '$username' deleted."elseecho "Error: Username '$username' does not exist."exit 1
    fi
}


# Function to reset the password of an existing user account
reset_password() {
    read -p "Enter the username to reset password: " username


    # Check if the username existsif id "$username" &>/dev/null; thenread -s -p "Enter the new password: " new_password
        echo -e "\n"


        # Reset the password
        sudo usermod -p "$(openssl passwd -1 "$new_password")" "$username"


        echo "Success: Password for user '$username' reset."elseecho "Error: Username '$username' does not exist."exit 1
    fi
}


# Function to list all user accounts on the system
list_users() {
    echo "List of User Accounts:"cut -d: -f1,3 /etc/passwd | column -t
}


# Function to create a new group
create_group() {
    read -p "Enter the group name: " group_name


    # Check if the group already existsif grep -q "^$group_name:" /etc/group; thenecho "Error: Group '$group_name' already exists."else
        sudo groupadd "$group_name"echo "Success: Group '$group_name' created."fi
}


# Function to add users to a group
add_users_to_group() {
    read -p "Enter the group name: " group_name
    read -p "Enter the comma-separated list of usernames to add to the group: " user_list


    # Check if the group existsif grep -q "^$group_name:" /etc/group; then
        IFS=',' read -ra users <<<"$user_list"for user in "${users[@]}"; do# Check if the user existsif id "$user" &>/dev/null; then
                sudo usermod -aG "$group_name" "$user"echo "Success: User '$user' added to the group '$group_name'."elseecho "Error: User '$user' does not exist."fidoneelseecho "Error: Group '$group_name' does not exist."fi
}


# Function to list users in a group
list_users_in_group() {
    read -p "Enter the group name: " group_name


    # Check if the group existsif grep -q "^$group_name:" /etc/group; thenusers=$(getent group "$group_name" | cut -d: -f4)
        if [ -z "$users" ]; thenecho "No users in the group '$group_name'."elseecho "Users in the group '$group_name': $users"fielseecho "Error: Group '$group_name' does not exist."fi
}


# Check if there are no arguments provided
if [ $# -eq 0 ]; then
    display_usage
    exit 1
fi


# Parse command-line options
while [ "$#" -gt 0 ]; docase "$1" in
    -c | --create)
        create_user
        ;;
    -d | --delete)
        delete_user
        ;;
    -r | --reset)
        reset_password
        ;;
    -m | --modify)
        modify_user
        ;;
    -cg | --create_group)
        create_group
        ;;
    -mg | --modify_group)
        add_users_to_group
        ;;
    -lg | --list_group)
        list_users_in_group
        ;;
    -l | --list)
        list_users
        ;;
    -h | --help)
        display_usage
        exit 0
        ;;
    *)
        echo "Error: Unknown option '$1'."
        display_usage
        exit 1
        ;;
    esacshift
done


exit 0



Features of the User Management Script

1. Creating User Accounts

Creating a new user account is a common administrative task. The script prompts the administrator to enter a new username and password, ensuring the account is securely set up.

./usermanagement.sh -c

2. Creating and Managing Groups

The script allows the creation of new groups, essential for organizing users efficiently. Additionally, it facilitates the addition of multiple users to a specific group, streamlining group management.

./usermanagement.sh -cg # Create a new group 
./usermanagement.sh -mg # Add users to a group 
./usermanagement.sh -lg # List users in a group

3. Deleting User Accounts

When a user account is no longer needed, the script simplifies the process of deleting it. The administrator is prompted to enter the username to be deleted.

./usermanagement.sh -d

4. Resetting User Passwords

Password resets are straightforward with the script. It prompts for the username and the new password, ensuring a secure and efficient password change.

./usermanagement.sh -r

5. Modifying User Groups

Modifying a user's group membership is made easy. The script prompts for the group name and the username, ensuring users are efficiently managed across different groups.

./usermanagement.sh -m

6. Listing User Accounts

The script provides a simple way to list all user accounts on the system, aiding administrators in gaining an overview of the existing users.

./usermanagement.sh -l

Simplifying Administrative Tasks

One of the primary advantages of the usermanagement script is its ability to simplify routine administrative tasks. With clear prompts and informative messages, even users with minimal Linux experience can confidently manage user accounts and groups.

How to Use the User Management Script

The script is designed to be user-friendly, with a simple syntax and clear options. The help option provides a quick reference guide:

./usermanagement.sh -h

Conclusion

Efficient user management is crucial for maintaining a secure and organized Linux environment. The usermanagement script simplifies this process, offering a reliable and user-friendly solution for administrators. Whether creating user accounts, managing groups, or performing other routine tasks, this script provides a versatile tool to streamline Linux system administration.

Feel free to customize and extend the script based on your specific requirements. Download the usermanagement script and start simplifying your user management tasks today.

  • Linux
  • Shell Script
  • DevOps

Keep reading

Linux System AdminFeb 8, 2026

OpenClaw: The AI That Actually Does Things — A Complete Guide

Artificial intelligence assistants have rapidly evolved from simple chat interfaces into systems that can execute real tasks . Among the latest and most talked-about examples is OpenClaw — an open-source autonomous AI agent that goes beyond conversation and performs actions on your behalf. In this article, you’ll learn what OpenClaw really is, how it works, the core features that make it unique, real-world use cases, and what you should consider before using it in production. 🔍 What Is OpenClaw? OpenClaw is a free, open-source autonomous AI assistant that runs locally on your machine or server and executes tasks rather than merely responding with text. Originally released in November 2025 by developer Peter Steinberger , it evolved from earlier projects known as Clawdbot and Moltbot . Unlike traditional chatbots like ChatGPT or Siri — which generate responses — OpenClaw actually performs actions such as automating workflows, interacting with apps, managing messages, and executing commands on your system. ⚙️ How OpenClaw Works At its core, OpenClaw acts as an agentic interface powered by large language models (LLMs). You send it instructions via familiar messaging platforms like WhatsApp , Telegram , Discord , Slack , Signal , or iMessage , and it interprets your intent into real operations. Here’s what makes it work: Local-first execution — the agent runs entirely on your machine or server , so your data stays under your control. Model flexibility — OpenClaw can integrate with external LLMs such as Claude, GPT-4, or even self-hosted models via platforms like Ollama. Messaging interfaces — you don’t install a new app; you use the chat clients you already know. This unique combination enables OpenClaw to be both powerful and flexible, responding to conversational cues and translating them into actions . 🧠 Core Features That Set It Apart 🤖 Action-Driven Automation OpenClaw doesn’t just suggest what to do — it does it . For example: Sort and reply to emails Schedule meetings and manage calendars Scrape and interact with websites Run shell commands or scripts Generate reports and summaries 🛠 Rich Integrations OpenClaw supports 50+ channels and platforms, connecting with the apps you use every day without forcing you into a new ecosystem. 🧩 Extensible Ecosystem A community-driven registry called ClawHub lets users install additional skills — modular extensions that broaden what the AI can do. 🗄️ Persistent Local Memory Rather than being ephemeral like most chatbots, OpenClaw remembers your context , preferences, and workflows over time. 📈 Real-World Use Cases OpenClaw serves a wide range of users — from individual power users to development and operations teams. Some common workflows include: Developer automation: CI/CD triggers, test suite coordination, infrastructure task automation Productivity workflows: Cleaning inboxes, generating summaries, scheduling events Data handling: Parsing spreadsheets, automating exports and uploads Browser automation: Extracting insights from web pages without manual clicks The shared idea across all these scenarios is that OpenClaw acts as a digital teammate , taking repetitive or complex tasks off your hands. 🔐 Privacy and Security Considerations Because OpenClaw runs locally and bridges deep into your system, it’s important to treat it like any powerful tool : It may require access to emails, files, or system commands — which can introduce risk if not configured securely. The ClawHub skill ecosystem is community-driven. As with any third-party registry, users should exercise caution and vet plugins before installing. Running agents with open permissions — especially exposed to the Internet — can pose security challenges if not isolated or hardened. In other words: while OpenClaw empowers automation, security practices and thoughtful deployment are essential . 📦 Getting Started If you’re curious to explore OpenClaw yourself: Choose your platform — it runs on macOS, Windows, or Linux. Install via command line — simple CLI tools help streamline setup. Connect messaging apps — tie your preferred chat tool to the agent. Configure your AI model — plug in your favorite LLM based on cost, speed, or privacy needs. For developers and IT teams, deploying OpenClaw on dedicated servers or VMs opens up even more powerful automation workflows. 🧾 Final Thoughts: AI That Acts OpenClaw represents a significant step in the evolution of AI assistants — shifting from chat-centric paradigms to action-centric autonomy. Its blend of local control, messaging integration, and extensible automation can transform workflows across personal productivity, developer tooling, and DevOps. If you’re looking to streamline how work gets done — and build systems that execute tasks on your behalf — OpenClaw is worth exploring. And if you need help deploying or optimizing it securely for your environment, experts in autonomous AI deployment can make the process smooth and reliable.

Read article →
Web DevelopmentJan 10, 2026

Vibe Coding: The Complete Guide to AI-Assisted Software Development

Introduction Vibe coding is rapidly changing how modern software is built. Instead of writing every line of code manually, developers, founders, and product teams now collaborate with AI-powered coding tools to move faster, prototype quicker, and ship products with fewer resources. Tools like Lovable, Replit, Bolt, Cursor, Windsurf, Augment Code, Kiro, and Antigravity have made it possible for even non‑engineers to generate functional applications. However, speed does not automatically equal quality. This is where real engineering expertise becomes essential. This guide explains what vibe coding is, how it works, the tools involved, best practices, limitations, and how to turn AI-generated code into production‑ready software. What Is Vibe Coding? Vibe coding is a development approach where developers guide AI tools using intent, prompts, and high‑level direction rather than writing all code manually. The "vibe" refers to focusing on what you want to build instead of how every line is written . In practice, vibe coding combines: Natural language prompts AI code generation and refactoring Human oversight and engineering judgment The result is faster iteration, especially during early-stage development. Why Vibe Coding Is Growing So Fast Several factors have driven the rise of vibe coding: 1. Faster Time to Market Startups and solo founders can go from idea to working prototype in days instead of months. 2. Lower Technical Barriers Non‑technical founders can participate directly in building products. 3. Cost Efficiency Early development costs are reduced by minimizing manual coding time. 4. Improved Developer Productivity Experienced engineers use AI as a force multiplier, not a replacement. Popular Vibe Coding Tools Lovable Lovable focuses on generating full-stack applications from product descriptions, making it popular among startup founders. Replit Replit provides an AI‑assisted cloud development environment that supports rapid prototyping and collaboration. Bolt Bolt specializes in quickly scaffolding applications and features from high‑level instructions. Cursor Cursor enhances traditional IDE workflows with AI-driven code suggestions, refactoring, and debugging. Windsurf Windsurf emphasizes fast iteration and developer experience with AI-assisted coding flows. Augment Code, Kiro, and Antigravity These newer tools focus on improving AI reasoning, context awareness, and multi-file code generation. What Vibe Coding Is Good At Vibe coding excels in the following areas: MVP development Rapid prototyping UI scaffolding CRUD applications Feature experimentation Learning and exploration For early-stage products, vibe coding can dramatically accelerate progress. Where Vibe Coding Falls Short Despite its advantages, vibe coding has clear limitations: 1. Architecture Issues AI-generated projects often lack scalable architecture and clean separation of concerns. 2. Security Risks Authentication, authorization, and data handling are frequently implemented incorrectly. 3. Performance Problems AI does not consistently optimize for performance, memory usage, or scalability. 4. Deployment Gaps Many vibe-coded projects fail during deployment due to missing DevOps considerations. From Vibe Coding to Production‑Ready Software To move from AI-generated code to a real product, human engineering is required. Key Steps: Code review and refactoring Proper backend architecture Database optimization Security hardening Environment configuration CI/CD setup Monitoring and logging This is where experienced full‑stack and DevOps engineers add the most value. Best Practices for Effective Vibe Coding Start with clear product requirements Use small, focused prompts Review every generated file Avoid blind copy‑paste into production Test early and often Plan deployment from day one Treat AI as a junior developer, not a lead architect Who Should Use Vibe Coding? Vibe coding is ideal for: Startup founders Indie hackers Product managers Early-stage teams Experienced developers seeking speed It is less suitable for regulated industries or mission‑critical systems without strong engineering oversight. Vibe Coding and the Future of Software Development Vibe coding is not replacing developers. It is reshaping the role of engineers toward: System design Architecture decisions Code review and validation Security and scalability Teams that combine AI tools with strong engineering fundamentals will have a competitive advantage. Final Thoughts Vibe coding represents a powerful shift in how software is built. When used correctly, it enables faster innovation and lowers barriers to entry. When used without proper oversight, it introduces technical debt and risk. The most successful teams treat vibe coding as a collaboration between AI and experienced engineers—not a shortcut around engineering principles. If you are building with AI tools and want to turn your project into a reliable, scalable product, professional engineering support makes all the difference.

Read article →
Linux System AdminFeb 14, 2024

Complete Guide to Linux Backup: How to Backup System Files and Databases

Backup Script This Bash script provides a simple and comprehensive backup solution for files and databases, including MySQL, PostgreSQL, and MongoDB. Configuration Run the script in the terminal. Enter the backup directory path when prompted. Specify the files or directories to be backed up. Database Configuration Configure database credentials and connection details: MySQL : Set mysql_user to your MySQL username. Set mysql_password to your MySQL password. PostgreSQL : Set postgres_user to your PostgreSQL username. Set postgres_password to your PostgreSQL password. MongoDB : Set mongodb_host to your MongoDB host. Set mongodb_port to your MongoDB port. Backup Process The script performs the following backup tasks: Files Backup : Compress specified files or directories into a timestamped tarball. MySQL Backup: Dump all MySQL databases into a timestamped SQL file. PostgreSQL Backup: Dump all PostgreSQL databases into a timestamped SQL file. MongoDB Backup: Dump all MongoDB databases into a timestamped directory. Compress the MongoDB dump into a tarball. #!/bin/bash # Configuration read -p "Where to backup?: " backup_dir read -p "Which files need to backup?: " backup_file mysql_user="root_pass" mysql_password="" postgres_user="postgres_user" postgres_password="postgres_pass" mongodb_host="localhost" mongodb_port="27017" # Create a timestamp for the backup timestamp=$(date +"%Y%m%d_%H%M%S") # Create backup directory if it doesn't exist mkdir -p "$backup_dir" # Backup files files_backup_filename="files_backup_$timestamp.tar.gz" tar -czf "$backup_dir/$files_backup_filename" "$backup_file" # Backup MySQL databases mysql_backup_filename="mysql_backup_$timestamp.sql" sudo mysqldump -u "$mysql_user" -p"$mysql_password" --all-databases >"$backup_dir/$mysql_backup_filename" if [ $? -eq 0 ]; thenecho "MySQL backup completed successfully: $mysql_backup_filename" elseecho "Error: MySQL backup failed."exit 1 fi # Backup PostgreSQL databases postgres_backup_filename="postgres_backup_$timestamp.sql" pg_dumpall -U "$postgres_user" -h localhost -w -f "$backup_dir/$postgres_backup_filename" if [ $? -eq 0 ]; thenecho "PostgreSQL backup completed successfully: $postgres_backup_filename" elseecho "Error: PostgreSQL backup failed."exit 1 fi # Backup MongoDB databases mongodb_backup_filename="mongodb_backup_$timestamp.tar.gz" mongodump --host "$mongodb_host" --port "$mongodb_port" --out "$backup_dir/mongodb_dump" tar -czf "$backup_dir/$mongodb_backup_filename" -C "$backup_dir" mongodb_dump if [ $? -eq 0 ]; thenecho "MongoDB backup completed successfully: $mongodb_backup_filename" elseecho "Error: MongoDB backup failed."exit 1 fi # Optional: Clean up old backups (e.g., keep only the last 7 days) find "$backup_dir" -type f -name "mysql_backup_*" -mtime +7 -delete find "$backup_dir" -type f -name "postgres_backup_*" -mtime +7 -delete find "$backup_dir" -type f -name "mongodb_backup_*" -mtime +7 -delete echo "Backup process completed successfully." Usage Run the Script: Open a terminal and navigate to the directory containing the script. Execute the script by running the following command: chmod +x backup_script.sh ./backup_script.sh Provide Configuration: Follow the prompts to provide the required configuration parameters. Backup Execution: The script will create backups of files, MySQL databases, PostgreSQL databases, and MongoDB databases based on the provided configuration. Each backup file will be named based on the current timestamp. View Backup Completion: Upon completion, the script will display messages indicating the success or failure of each backup operation. Error messages will be displayed if any of the backup operations fail. Optional: Clean Up Old Backups: The script includes an optional feature to clean up old backups. By default, it keeps only the backups created within the last 7 days. Optional: Clean Up Old Backups By default, the script keeps only the last 7 days of backups. You can adjust this duration in the script. Important Notes Ensure that you have the necessary permissions to perform backup operations on the specified files and databases. Review the configuration parameters carefully to ensure that they are accurate. Monitor the backup process and review the backup files to ensure that the data is backed up correctly. Make necessary adjustments to the script as per your specific requirements and environment. By following these instructions, you can effectively use the backup script to create backups of your files and databases in a secure and efficient manner.

Read article →