#90daysofdevops { Day -5}

Nikhil KathaleNikhil Kathale
4 min read

So welcome today is day 5 of the challenge! We will perform some tasks today which will give us some hands-on experience on shell scripting, and as usual, BOOOOOOM! Our confidence ๐Ÿ’ป๐Ÿ’ฅ๐Ÿš€ is about to skyrocket! Get ready for an exciting day of scripting that will leave you feeling pumped and ready to conquer new challenges! Let's dive in and make today's session unforgettable! ๐Ÿ”ฅโœจ

TASK -1

You have to do the same using Shell Script i.e using either Loops or command with start day and end day variables using arguments -

##okay so this is the result , i have return the steps in # please just don't copy the commands as it is cause the directories location may differ from user to user.##

This is the output -

TASK -2

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

Here's a breakdown of what the script does:

  1. Set the source and destination directories.

  2. Create a timestamp to use in the backup file name.

  3. Check if the source directory exists.

  4. Create a compressed tarball (.tar.gz) of the source directory and its contents.

  5. Check if the backup was successful.

##okay so this is the result , i have return the steps in # please just don't copy the commands as it is cause the directories location may differ from user to user.##

This is the output -

TASK -3

What is Cron and Crontab?

Cron is like the punctual wizard of the Linux world! โฐโœจ It's a time-based job scheduler, always on time, never fashionably late. Imagine if your computer had a personal assistant dedicated to running tasks at specific times โ€“ that's Cron for you! ๐Ÿง™โ€โ™‚๏ธ๐Ÿ’ป

Now, let's talk about its sidekick, Crontab! ๐Ÿ“…๐Ÿค– Crontab is like the stylish planner where you jot down when you want Cron to sprinkle its magic. It stands for "Cron Table," and it's where you schedule tasks with a dash of elegance! โœจ๐Ÿ“

Together, they make the ultimate dynamic duo of automation in the Linux universe! ๐Ÿš€๐ŸŒŒ So, when you want your tasks to be executed with the precision of a Swiss watch, call in Cron and Crontab โ€“ the superheroes of scheduling! ๐Ÿฆธโ€โ™‚๏ธ๐Ÿฆธโ€โ™€๏ธ๐Ÿ’ฅ

A crontab file consists of lines representing individual jobs. Each line has six fields that define the schedule for a particular task:

  1. Minute (0-59)

  2. Hour (0-23)

  3. Day of Month (1-31)

  4. Month (1-12)

  5. Day of Week (0-7, where both 0 and 7 represent Sunday)

  6. Command to be executed

TASK -4

What is User management ?

In Linux, user management refers to the processes and tools used to create, modify, and manage user accounts on a system. User accounts are essential for controlling access to the system's resources and ensuring proper security measures. Let's explore some key aspects of user management in Linux! ๐Ÿง๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ”

Creating Users:

To create a new user, the useradd command is commonly used. For example:

bashCopy codesudo useradd -m username

The -m flag ensures the home directory for the user is created. ๐Ÿก

Setting Passwords:

Use the passwd command to set or change a user's password:

bashCopy codesudo passwd username

After running this command, you'll be prompted to enter the new password securely. ๐Ÿ”’

Modifying User Properties:

The usermod command allows you to modify various user properties. For instance, to add a user to a specific group:

bashCopy codesudo usermod -aG groupname username

The -aG flags append the user to the specified group. ๐Ÿค

Deleting Users:

To remove a user, the userdel command can be employed:

bashCopy codesudo userdel -r username

The -r flag removes the user's home directory as well, ensuring a complete removal. ๐Ÿšฎ

Managing User Groups:

Group management is integral too. The groupadd, groupmod, and groupdel commands help create, modify, and delete groups. ๐Ÿ‘ฅ

Understanding /etc/passwd and /etc/shadow:

User information is stored in the /etc/passwd file, while encrypted passwords are stored in /etc/shadow. These files play a crucial role in user management. ๐Ÿ“๐Ÿ”

Superuser and Sudo:

The superuser, often referred to as "root," has elevated privileges. The sudo command allows regular users to execute commands with superuser privileges, enhancing security. ๐Ÿ‘‘๐Ÿš€

Graphical User Interface (GUI) Tools:

For those who prefer a graphical interface, Linux provides tools like users-admin or gnome-system-tools that offer a user-friendly way to manage users and groups. ๐Ÿ–ฅ๏ธ๐Ÿ”ง

Linux user management is a fundamental aspect of system administration, ensuring secure and organized access to resources. Whether working from the command line or utilizing graphical tools, effective user management is key to maintaining a well-configured and secure Linux environment! ๐ŸŒโœจ

Connect with me on LinkedIn๐Ÿ‘”๐ŸŒ:https://www.linkedin.com/in/nikhil-kathale-27544a1b5/

12
Subscribe to my newsletter

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

Written by

Nikhil Kathale
Nikhil Kathale