Linux Challenge #2 (Users and Permissions)

Welcome to Linux Challenge #2! In this challenge, you will delve into the world of Linux users and permissions. As an aspiring Linux user, it's crucial to understand how users and permissions work in a Linux system.
Create a new user called "user1".
sudo adduser user1 # User1 is a name for userCreate a new file called "file1.txt" in your home directory.
touch file1.txtChange the ownership of "file1.txt" to "user1".
sudo chown user1 file1.txtConfirm that "user1" has read and write permissions for "file1.txt".
ls -lart # It will list down all the details of that file.Create a new group called "group1".
sudo addgroup group1 # Group1 is the name of the groupAdd "user1" to "group1".
sudo usermod -a -G group1 user1Change the ownership of "file1.txt" to "group1".
sudo chown :group1 file1.txtConfirm that "group1" has read and write permissions for "file1.txt".
sudo chmod g+rw file1.txtCreate a new directory called "dir1" in your home directory.
mkdir dir1Change the ownership of "dir1" to "user1".
sudo chown user1 dir1 # user1 is a user and dir1 is a directoryConfirm that "user1" has read, write, and execute permissions for "dir1".
ls -l dir1Change the ownership of "dir1" to "group1".
sudo chown :group1 dir1/Confirm that "group1" has read, write, and execute permissions for "dir1".
sudo chmod g+rwx dir1Create a new user called "user2".
sudo adduser user2Confirm that "user2" does not have access to "file1.txt" or "dir1".
ls -l file1.txt #user2 does not have access to text file. ls -l dir1 #user2 does not have access to this dir file.Add "user2" to "group1".
sudo usermod -a -G group1 user2Confirm that "user2" now has access to "file1.txt" and "dir1".
ls -l file1.txt ls -l dir1Remove the "user1" and "user2" users.
sudo userdel user1 # for removing user1. sudo userdel user2 # for removing user2.Remove the "group1" group.
sudo groupdel group1 # group1 will be deleted.Remove the "dir1" directory and its contents.
sudo rm -rf dir1This challenge will test your knowledge and skills in managing Linux users and permissions and will require you to think critically and troubleshoot to complete the tasks successfully. Good luck, and have fun exploring the world of Linux users and permissions!