Day-05:Advanced Linux Shell Scripting for DevOps Engineers with User management.

Day-05:Advanced Linux Shell Scripting for DevOps Engineers with User management.

Write a bash script createDirectories.sh that when the script is executed with three given arguments (one is directory name and second is start number of directories and third is the end number of directories ) it creates specified number of directories with a dynamic directory name.

Create a Script to backup all your work done till now.

Read about Cron and Crontab, to automate the backup script.

Cron is a time-based job scheduler that allows users to schedule tasks to run automatically at specific times or intervals, without the need for manual intervention. These scheduled tasks are known as cron jobs.

Crontab is a file used to store the list of commands or scripts that are scheduled to run at specific times using the Cron utility.

To create or edit the crontab file, you can use the "crontab" command followed by specific options and arguments, such as:

  • "crontab -e" to edit the current user's crontab file.

  • "crontab -l" to list the current user's crontab file.

  • "crontab -r" to remove the current user's crontab file.

  • "crontab -u" to modify the crontab file for a specific user.

    Crontab is a powerful tool that allows you to automate repetitive tasks and improve system efficiency.

    Read about User Management.

    User management in Linux refers to the process of creating, modifying, and deleting user accounts on a Linux system. It also involves setting user permissions and access controls and managing user passwords.

    To create a user account

    useradd Afsha

    To check user account properties

    sudo cat /etc/passwd

    To create a user account password

    passwd Afsha

    For switching user account

    su Afsha

    To delete a user account

    userdel Afsha

    To add a group account

    groupadd devops

    To check group account property

    sudo cat /etc/group

    To delete the group account

    groupdel devops

    To add a single member to a group

    gpasswd -a Afsha devops

    To add multiple members to a group

    gpasswd -M kajal,amreen,tash devops

    Create 2 users and just display their Usernames.

    Thank you for reading this article!