1.Is each of the following an absolute pathname, a relative pathname, or a simple filename? a. milk_co b. correspond/business/milk_co c. /home/max d. /home/max/literature/promo e. .. f. letter.0210
A: a= Directory File b= relative c= absolute d= absolute e= Hidden File or can be used for the relative parent directory f= Ordanary/Simple File
2. List the commands you can use to perform these operations: a. Make your home directory the working directory b. Identify the working directory
A: a= cd b= pwd
Is Each Of The Following An Absolute Pathname, A Relative Pathname, Or A Simple Filename?
3. If the working directory is /home/max with a subdirectory named literature, give three sets of commands you can use to create a subdirectory named classics under literature. Also give several sets of commands you can use to remove the classics directory and its contents.
A: a= mkdir /home/max/literature/classics, mkdir ~max/literature/classics, or mkdir ~/literature/classics
b= rmdir /home/max/literature/classics, rmdir ~max/literature/classics, rmdir ~/literature/classics, rm -r /home/max/literature/classics
4. The df utility displays all mounted filesystems along with information about each. Use the df utility with the –h (human-readable) option to answer the following questions. a. How many filesystems are mounted on your Linux system? b. Which filesystem stores your home directory? c. Assuming your answer to exercise 4a is two or more, attempt to create a hard link to a file on another filesystem. What error message do you get? What happens when you attempt to create a symbolic link to the file instead?
A: a= 5 b= /dev/sda1 c= Failed to create hard link `/home/Destop’ => `draft’: Permission denied; Failed to create symbolic link `/home/Destop’: Permission denied
5. Suppose you have a file that is linked to a file owned by another user. How can you ensure that changes to the file are no longer shared?
A: If you have root you can use “chown” to change ownership rights of the file and then remove all permissions. If the file is has a hard link, you can cp the link and rename it. The changes to the copied file will no longer appear in the original file.
6. You should have read permission for the /etc/passwd file. To answer the following questions, use cat or less to display /etc/passwd. Look at the fields of information in /etc/passwd for the users on the local system. a. Which character is used to separate fields in /etc/passwd? b. How many fields are used to describe each user? c. How many users are on the local system? d. How many different login shells are in use on your system? (Hint: Look at the last field.) e. The second field of /etc/passwd stores user passwords in encoded form. If the password field contains an x, your system uses shadow passwords and stores the encoded passwords elsewhere. Does your system use shadow passwords?
A: a= : b= 7 c= 36 d= 2 e= Yes it uses shadow passwords
7. If /home/zach/draft and /home/max/letter are links to the same file and the following sequence of events occurs, what will be the date in the opening of the letter? a. Max gives the command vim letter. b. Zach gives the command vim draft. c. Zach changes the date in the opening of the letter to January 31, writes the file, and exits from vim. d. Max changes the date to February 1, writes the file, and exits from vim.
A: Max will get a “WARNING: The file has been changed since reading it!!!” message and will be asked if he really wants to write to it.
8. Suppose a user belongs to a group that has all permissions on a file named jobs_list, but the user, as the owner of the file, has no permissions. Describe which operations, if any, the user/owner can perform on jobs_list. Which command can the user/owner give that will grant the user/owner all permissions on the file?
A: a= ls b= chmod u+rwx jobs_list
9. Does the root directory have any subdirectories you cannot search as an ordinary user? Does the root directory have any subdirectories you cannot read as a regular user? Explain.
A: No, users have permission to read, write or execute in my home directory. Some hidden directories allow rwx permissions only to the user where as the regular subdirectories allow only xr permissions to groups and only x permissions to others.
10. Assume you are given the directory structure shown in Figure 6-2 on page 187 and the following directory permissions: d–x–x— drwxr-xr-x 3 zach pubs 512 2010-03-10 15:16 business 2 zach pubs 512 2010-03-10 15:16 business/milk_co For each category of permissions—owner, group, and other—what hap- pens when you run each of the following commands? Assume the working directory is the parent of correspond and that the file cheese_co is readable by everyone. a. cd correspond/business/milk_co b. ls –l correspond/business c. cat correspond/business/cheese_co
A: a= u,g: OK; o: Permission denied b= ugo: Permission denied c= ug: ls a directory; o: Permission denied