Answer To: This order is related to Host Security
Deepak answered on Oct 15 2022
Assignment Part A
Deliverable and Instructions:
This lab will guide you through the configuration and management of your Linux system. This lab begins once you are already connected to your Linux host through the Netlab environment. For instructions on how to get connected to the Netlab environment, please consult the Lab Connectivity Guide on D2L.
During the course of this lab you will create a user with a username consisting of your first initial and last name - i.e. knaughton. Throughout this lab when you see the term yourname, I am referring to this user account. Substitute it in commands accordingly with the correct username. Please do not create a user actually named “yourname”. I use the presence of your username in screenshots to validate that the screenshots are your own, and you will not receive credit if you do not have a unique username.
The submission file for this lab will be a pdf version of this document, with your answers and screenshots added. Each correctly answered question will count for 1 point. Each screenshot will also count for 1 point and will be evaluated on whether it fully meets the requirements of the screenshot prompt. Your score will be determined by the percentage of total questions and screenshot prompts answered correctly.
Answer the questions below the prompts indicated in green. If the question is multi-part, you must answer all parts correctly to receive the point for that question. No partial credit will be given. Add screenshots below the prompts indicated in green. If your screenshot does not meet the requirements of the prompt you will not receive credit for that screenshot.
Each individual question is worth 1 point. Each individual screenshot prompt is worth 1 point.
Ensure that each screenshot is readable in-line in the submission document.
If I am unable to read the contents of your screenshot in the document because it is too large of a screenshot, it will not count for credit. Do not include screenshots of your whole desktop or whole terminal window to when the prompt is asking about one single command.
Section 1: File & Directory Management
Step 1: Use the Netlab environment to access your “Linux Server 1” machine as the student user. You will not need to use any of the Windows machines for this lab. They will be used in a future labs. Login with the username student and the password student. Once logged in you will see a prompt similar to the one below.
Question 1.1: What do the different components of the prompt mean? Explain each part of the prompt.
As the prompt opens up with the default input required to enter the name/user which you want to access. so we have to provide a username and after that, it will ask for a password for user input by you. Then it will open CLI as user@machine
Question 1.2: By looking at this prompt are you a normal user or a super user? How do you know?
I am a normal user. It is because if I was a super user then CLI have # rather than $.
Step 2: Enter the date command by typing date into the shell prompt. Include a screenshot of the output of the command.
Step 3: Use the passwd command to change the password of the student user you are logged in as. Just enter the passwd command with no arguments to change the password of the user you are logged in as.
Step 4: When prompted, enter the current password for the student account.
Step 5: When asked to enter a new password enter the password CSEC378418! And then enter it again to finish changing this password.
Step 6: Create a new file with the touch command. touch is a command that can be used to update the timestamp on an existing file or create a blank new file if used on a filename that doesn’t already exist. Use the touch command to make a file called eandujar.txt. For example, I would run the command touch knaughton.txt to create my file.
Step 7: Use the ls (list) command to list the contents of your current directory and include a screenshot of the output of the command. You should be able to see the file you just created.
Step 8: The file command will tell you some details about the file type and contents of a file. Use the file command on your new text file and include a screenshot of the output below.
Question 1.3: What does the file command you used in the last step tell you about the file you specified?
It tells about the content of the file but our file was just created and has nothing. So, the file command just gives an output of eandujar.txt: empty
Step 9: Lets add some contents to the file you just created. One of the quickest ways to do this is to redirect some contents into the file. echo is a utility that will take whatever input you give it and echo it back to you. Try running the command echo hello world and see what happens.
Step 10: echo takes text in via standard input (stdin) and spits it back out at you via standard output (stdout). We can redirect that output using the > character and send it to a file, rather than just to your screen. Try rerunning the command from the last step but now we will add an output redirect like so: echo hello world > eandujar.txt
Step 11: Now use the file command again on the text file. Include a screenshot of the output here.
Question 1.4: What changed about the output of the file command, why is it different?
Now file command outputs about the content type or encoding that the text file contains. It is different because earlier it was empty and now it has some text in it.
Step 12: Run the following command: head /etc/passwd to display the top 10 lines of this file. Include a screenshot of the output here.
Question 1.5: Why are there no passwords contained in this file? What file actually stores passwords?
It is because this file is readable by all users, that’s why this file contains info about users and their mappings. While /etc/shadow, is a system file in Linux that stores user passwords in encrypted form so that it will not be accessible by unauthorized.
Step 13: Now run the following: head -n 3 /etc/passwd and take a look at how the output differs from the last step.
Question 1.6: What do the command, option, and the argument used in the previous step do? Explain each.
Head command is used to extract the top 10 content from the beginning of the file, by using an argument with the head we can get different results as per the requirement. So, using head -n 3 is used to print the first 3 lines of the file and after this argument, the file location on which we want to perform the head command is mentioned.
Step 14: Research and find a command that can be used to only display the last 5 lines of a file. Use the command and include a screenshot of your output below.
we can use tail -n 5 /etc/passwd
Question 1.7: Explain what the command you used in the previous step does and explain any options you used.
Tail command can be used to display file content from the bottom, it has the same functionality as HEAD command but from the bottom. I have used -n argument , which is used to specify the number of lines or output you want.
So, we can use tail -n 5 /etc/passwd
Step 15: Use the cd (change directory) command to move around the file system. Enter the command cd / to change your directory from the student user’s home directory to the system’s root directory (which is represented by a “/”).
Step 16: Use the command ls to see which directories are contained here, and then move into one of them using cd, then use pwd to show where you are. Include a screenshot after running these commands below.
Note: You can move through more than one directory at a time if you specify the whole file path. Let’s try this in the next step.
Step 17: From your current location, use the command cd /home/student
Question 1.8: Is the file path used in the last step an example of a relative path or an absolute path? How do you know?
The last step used is an example of an absolute path because a relative path never starts with / character.
Step 18: Use the pwd (print working directory) command to display what directory you are currently working in. Include a screenshot of your output below.
Step 19: Use the touch command again to create a blank file named testfile.txt in the student user’s home directory.
Step 20: After creating the file, use ls again, but this time use the options -l (lowercase L) and -t to list out the files in this directory and include a screenshot to display that you have created a file named testfile.txt in the /home/student directory.
Question 1.9: What do the -l and -t options do? How did they change the output of the ls command?
Ls -l, gives us info about files in the directory with their info such as size, modified date and time, file name, its permissions.
Ls -t, -t argument is with ls command to list files and directories in descending order based on their last modified date and time.
The first output without the -t argument gives us info as default but using the -t argument info gets sorted in descending order.
Step 21: Use the command mkdir (make directory) to create a new directory called Lab1 using the command mkdir Lab1. Since you are currently in /home/student, this new directory will be created there.
Step 22: Use ls -lt again to view the newly created directory, and then use the file command on the Lab1 directory. Include a screenshot of the output of both commands below.
Question 1.10: Without using the file command and without using the color-coded file names, how would you be able to tell that Lab1 is a directory based on the output of ls -lt?
With the help of the first field of the output, we can tell if something is a file or folder/directory, because if it’s a file field1 has”-“ and if it’s a directory/folder then “d”.
Step 23: Use the cp (copy) command to make a copy of testfile.txt using the following command:
cp testfile.txt testfile2.txt After running this command use the ls -lt...