Skip to content

Script IaC para provisionamento automatizado de usuários, grupos e diretórios em ambientes Linux corporativos

Notifications You must be signed in to change notification settings

th-hoffmann/linux-user-provisioning

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Linux User Provisioning Automation

Status Shell Script Linux IaC

🇺🇸 English🇧🇷 Leia em Português

Automate user, group, and directory provisioning on Linux systems with Infrastructure as Code principles


📋 About the Project

This project was developed as part of the first challenge of DIO's Linux Fundamentals Training, applying Infrastructure as Code (IaC) concepts to completely automate user infrastructure creation in Linux environments.

🎯 Objective

Create a script that automatically provisions the entire organizational structure of a technology company, including users, permission groups, and departmental directories, ensuring any new virtual machine is ready for use after execution.


🏢 Organizational Structure

The script simulates the real structure of a technology company, creating realistic departments and users:

🏗️ Department 👥 Group 📁 Directory 👤 Users
Development GRP_DEV /desenvolvimento ana.silva, carlos.pereira, maria.santos
Operations GRP_OPS /operacoes joao.oliveira, roberto.costa, paula.ferreira
Security GRP_SEC /seguranca marcos.almeida, lucia.rodrigues, pedro.martins
Public everyone /publico shared access

⚡ Features

🔧 Automated Provisioning

  • Group Creation → Professional departmental groups
  • Directory Creation → Organizational folder structure
  • User Creation → Realistic accounts (firstname.lastname)
  • Permission Configuration → Group-based security

🛡️ Security & Permissions

  • 🔐 Encrypted Passwords → SHA-512 hash for all accounts
  • 🚫 Departmental Isolation → Group-restricted access (770)
  • 🌐 Shared Area → Public directory with full access (777)
  • 🔄 Idempotency → Can be executed multiple times safely

⚙️ External Configuration

  • 📄 Configuration Fileconfig.txt for easy customization
  • 🔧 Reusability → Adapt for different organizations without code changes
  • 📝 Simple Maintenance → Modifications only in configuration file

🚀 How to Use

📋 Prerequisites

  • Operating System: Linux (Ubuntu, Debian, CentOS, etc.)
  • Privileges: Root/sudo access
  • Dependencies: bash, openssl (usually pre-installed)

🔧 Installation & Execution

  1. Clone the repository:

    git clone https://github.com/th-hoffmann/linux-user-provisioning.git
    cd linux-user-provisioning
  2. Make the script executable:

    chmod +x linux-user-provisioning.sh
  3. Run the script:

    sudo ./linux-user-provisioning.sh
  4. Verify the results:

    # List created groups
    getent group | grep GRP_
    
    # List created users
    getent passwd | grep -E "(ana|carlos|maria|joao|roberto|paula|marcos|lucia|pedro)"
    
    # Check directories and permissions
    ls -la / | grep -E "(publico|desenvolvimento|operacoes|seguranca)"

📁 Project Structure

linux-user-provisioning/
├── 🚀 linux-user-provisioning.sh    # Main script
├── ⚙️  config.txt                   # Configuration file
├── 📖 README.md                     # Documentation (English)
└── 📖 README_pt-br.md              # Documentation (Portuguese)

⚙️ Customization

📝 Modifying Configurations

Edit the config.txt file to customize:

# Customization example
DIRETORIOS="/publico /sales /marketing /it"
GRUPOS="GRP_SALES GRP_MKT GRP_IT"
USUARIOS_SALES="jane.doe john.smith anna.johnson"
SENHA="MyCompany2025!"

🔄 Running Again

The script is idempotent - can be executed multiple times:

  • ✅ Existing elements are ignored
  • ✅ Only new elements are created
  • ✅ No conflicts or errors

🛡️ Security

🔐 Implemented Practices

  • Strong Passwords: Robust password policy with special characters
  • Encryption: SHA-512 hash for secure storage
  • Principle of Least Privilege: Department-restricted access
  • Separation of Duties: Isolated groups with specific permissions

⚠️ Security Considerations

🚨 Warning: This script is for development/test environments. For production, consider:

  • Integration with corporate authentication systems (LDAP/AD)
  • More stringent password policies
  • Detailed auditing and logging
  • Automated backup before execution

� Applied Concepts

🏗️ Infrastructure as Code (IaC)

  • Automation → Elimination of manual processes
  • Consistency → Same configuration in any environment
  • Version Control → Change management via Git
  • Reproducibility → Identical results across executions

🐧 Linux Administration

  • User Managementuseradd, groupadd
  • Permission Controlchmod, chown
  • Shell Scripting → Bash automation
  • System Management → Programmatic configuration

🤝 Contributing

Contributions are welcome! Feel free to:

  • 🐛 Report bugs
  • 💡 Suggest improvements
  • 🔧 Submit pull requests
  • 📖 Improve documentation

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


👨‍💻 Author

Developed by th-hoffmann as part of DIO's Linux Fundamentals Training.


⭐ If this project was helpful, consider giving it a star!

🔙 Back to top

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%