☑️Day 18: Exploring Advanced User Management, Permissions, and Automation in Red Hat🚀

☑️Day 18: Exploring Advanced User Management, Permissions, and Automation in Red Hat🚀

🔹Table of Contents :

  • ✅Introduction

  • ✅Advanced User Management

  • ✅File Permissions and Ownership

  • ✅Automation with Shell Scripts

  • ✅Essential Commands for System Administration

  • ✅Real-World Applications

  • ✅Key Takeaways


Welcome to Day 18 of my DevOps journey! Today, I focused on advanced user management, permissions, and further automation in Red Hat Enterprise Linux (RHEL). These topics are critical for system administration, especially in managing multiple users and ensuring appropriate access control.


✅1. Advanced User Management in Red Hat

Managing users effectively is vital for maintaining security and proper access control in any enterprise environment. Here's what I practiced today:

  • Adding New Users:

    • To add a new user, I used the useradd command. This is crucial when onboarding new employees or setting up new service accounts.

    • Example:

    sudo useradd username
    sudo passwd username
  • This command creates a new user and sets a password for them. It’s used in real-world scenarios when granting new users access to the system.
  • Modifying User Accounts:

    • Sometimes, user accounts need to be updated. I used usermod to change user properties such as group memberships and home directories.

    • Example:

    sudo usermod -aG wheel username
  • This command adds the user to the wheel group, giving them administrative privileges.
  • Deleting Users:

    • When a user leaves the organization, it’s important to revoke their access. I practiced deleting users with userdel.

    • Example:

sudo userdel username

✅2. File Permissions and Ownership

File permissions in Linux are vital to controlling who can access or modify files. Here’s how I worked with file permissions and ownership today:

  • Changing File Ownership:

    • The chown command allows you to change the ownership of files and directories. This is useful when transferring files between users or when managing permissions for different user groups.

    • Example:

sudo chown user:group filename
  • Modifying Permissions with chmod:

    • Permissions are assigned to files and directories for read, write, and execute operations. I practiced modifying these permissions using chmod.

    • Example:

    chmod 755 filename
  • This sets the file permissions to allow the owner to read, write, and execute, while others can only read and execute.
  • Checking Permissions with ls -l:

    • I used the ls -l command to check the current permissions and ownership of files. It’s essential to regularly review permissions to avoid security risks.

    • Example:

ls -l /path/to/file

✅3. Automating Tasks Using Shell Scripting

Automation plays a huge role in a DevOps environment. Today, I practiced writing simple shell scripts to automate user management tasks:

  • Automating User Creation:

    • I wrote a script that accepts user input and adds new users. This script is useful in environments where new users are frequently onboarded.

    •   #!/bin/bash
        echo "Enter username:"
        read username
        sudo useradd $username
        sudo passwd $username
        echo "User $username added successfully!"
      
    • This simple script saves time when adding multiple users at once.

  • Changing Passwords (passwd):

    • I also used passwd to change the password for users, ensuring that security policies are met.

    • Example:

    •   sudo passwd username
      

✅4. Essential Commands Practiced Today

Here are the key commands I worked with:

  • whoami: Shows the current user logged in. Useful to verify user roles during script execution.

  •   whoami
    
  • chmod: Modify file permissions

  •   chmod 755 filename
    
  • ls -l: Lists files along with their permissions and ownership.

  •   ls -l /home
    
  • passwd: Change or set user passwords,

  •   sudo passwd username
    
  • exit: Exit the current session or shell.

  •   exit
    

✅Key Takeaways

  • User Management: Understanding user creation, modification, and deletion is crucial for maintaining security and ensuring the right people have access to the right resources.

  • File Permissions: Properly managing file permissions and ownership is essential to ensure the security and integrity of files in multi-user environments.

  • Automation: Shell scripting is a powerful tool for automating routine tasks, saving time and reducing the risk of human error.

Stay tuned as I continue to dive deeper into DevOps and Red Hat in the coming days!

Happy Learning!😊

#90DaysOfDevOps

#RHEL #Linux #Security #SystemMonitoring #DevOps #TechJourney #Day17 #User Management #Automation #File Permissions