Learn the commands that allow you to handle file system


Can You please put the answer with the question and please the worksheet

Discussion:

The UNIX model for file-system security is pretty simple. Three classes of users, three types of permission . . . most modern systems provide a lot more options. Present your argument that those additions/extensions/complications are unnecessary. Argue that the model used by UNIX systems from the 60s is sufficient.

Can You give me like a two argument example

Assignment:

Purpose: To learn the commands that allow you to handle file system security.

NOTE: These instructions reflect the user interface in version 12.04LTS of Ubuntu.

1. Boot your Ubuntu system and open three command shells. In one of those shells, use the su command to become the root user. In another, use the su command to become mingthemerciless (whom you should have created in Assignment #1).

NOTE: You will do most of your work with the shell recognizing you as your primary student identity.

2. In order to run the experiments in this lab, you will need three directories, each containg two or three files. Begin by creating the directories, giving them the names PermTest1, PermTest2, and PermTest3. While still in your home directory, edit three files. Name the first fav1.txt, and in it write about your favorite musical group. Name the second fav2.txt and write about your favorite movie. Finally, write about your favorite book in the file named fav3.txt.

3. Change the permissions on your files so that fav1.txt allows all three categories of user to have read and write permission. Give read and write permission on fav2.txt to the file owner only. To fav3.txt, give no permissions to the owner, but give (only) read and write permissions to the last category, "everyone else". What numbers did you use?

4. Now make copies of those three files in each of your first two PermTest directories and move them into the last. NOTE: You will not be allowed to do anything with the fav3.txt file - did you expect that?

5. Change the permissions on the PermTest directories as follows: give the first one read, write, and execute for all three categories of user, give the second read and write for all three categories, and give the third read and write permission only for the owner.

6. There still is one mechanical problem that may get in the way of our experiements. To make sure it does not, change the permissions on your home directory to read, write and execute for all three categories. NOTE: Your home directory probably resembles /home/username.

7. In each of your three command shells, change your working directory to the home directory of your primary student identity. (NOTE: Since you were working under that identity when you opened your command shells, and since you used the su command to change your identity, you may not need to change directories at all. How will you know?)

8. Try to obtain a listing of the contents of the PermTest directories in the shell which recognize you as yourself, then repeat the attempt within the shell which recognizes you as mingthemerciless. Use the cd command to try to move into each directory (then use cd .. to move back up to your original location). What is the effect of execute permission when applied to a directory?

9. Now obtain a listing of the PermTest directories within the shell which recognizes you as the root user. What is different about the commands run by that user?

10. In all three windows, change your working directory to PermTest1, which is open to everyone. Use the cat command to read the contents of both files, repeating the command in each of your three windows. Use the vi editor to try to change the contents of the files in each window. Do you obtain the results you expected? If not, what was different?

Worksheet

The purpose of this lab is to practice some of the features which allow commands to be handled properly.

NOTE: These instructions reflect the user interface in version 12.04LTS of Ubuntu.

1. Boot your system and open a command shell.

2. Perform the command ls -l /etc and watch the information scroll past faster than you can read it.

3. Now perform the command ls -l /etc > etc-list. How much output is displayed on the screen? Where did it go?

4. Execute the command ls -l to view the files in your directory. Then execute the command wc etc-list. How many lines are in that file? What is its size?

5. Use vi to remove a few lines from the etc-list file, then execute wc etc-list to see the result. How many lines are in that file now? What is its size?

6. Now repeat steps 3 and 4. Compare the file size to the answers you gave in steps 4 and 5. What happened to your changes?

7. Now execute the command ls -l /etc >> etc-list and wc etc-list. How many lines are in that file now? What is its size?

Can you explain the new file size?

8. In order to verify that the file contains two listings, look at the location where the first listing comes to an end and the second begins. Use a combination of the head and tail commands to view twenty lines from the file - the last ten lines of the first listing and the first ten lines of the second.

Hint #1: Step 4 provided information about the number of lines included in a single listing.

Hint #2: This command will display the five lines numbered from 8 to 12 in a file named testfile:

head -12 testfile | tail -5

Write the command sequence:

9. Recall that the find command identifies files and that the grep command is typically used to search inside of files. However, the grep command can be used to search through any chunk of text. For example, execute this command and describe the results:

ls -l /etc | grep net

The pipe symbol causes the grep command to treat the output of the ls command as text - and to search for file names within that output. Typically, we would accomplish this using a find command. What command would you write to search the /etc directory for files with names containing the string net?

The primary difference between these two approaches is that the find command is recursive (meaning that it searches through sub-directories), while the grep command is not. To more closely approximate the results of the ls/grep combination, you could use the following find command:

find /etc -maxdepth 1 -name *net*

To create an ls/grep combination that more closely approximates the find command, you might try:

ls -lR /etc | grep net

Study the man pages for ls, grep, and find to make sure you understand what these different combinations are doing.

Solution Preview :

Prepared by a verified Expert
Operating System: Learn the commands that allow you to handle file system
Reference No:- TGS01363969

Now Priced at $95 (50% Discount)

Recommended (97%)

Rated (4.9/5)