Use vi or vim to edit your script file to answer the questio
Use vi or vim to edit your script file to answer the questions posed by the following actions:
Check which group or groups you belong to
Check your default mask
Create a directory called garbage under your home directory
Create a directory called session2 under your home directory
Check the permission of this directory, make a note of it
Change your default mask so that the default permission is 644. What is the default permission for directories after you make this change?
Check the default permission for the garbage directory? Has it been changed after setting the default mask? Why or why not?
Delete this directory
Create a directory called fred under the session2 directory
Check the permission of this directory and make a note of it
Remove the x permission for this directory
Move to the session2 directory. You should have a problem. Do you know what the problem is? Fix the problem.
Create a file called helpme under this directory.
Put the following information into the helpme file
Fred Flintstone
Wilma Flintstone
Barney Rubble
Betty Rubble
Pebbles
Bam-Bam
Save this file
Rename this file to flintstones.txt
Check the permissions of this file. Can users in your group copy this file? Can they change it? Can users outside your group copy this file? Can they change this file? Is this file executable?
Change the permissions of this file so that every user can read, modify but not execute this file.
Print this file
Solution
Answers are provided in bold with steps asked:
Check which group or groups you belong to: groups
Check your default mask: umask
Create a directory called garbage under your home directory : mkdir garbage
Create a directory called session2 under your home directory : mkdir session2
Check the permission of this directory, make a note of it: ls -ld session2 (answer is drwxrwxr-x)
Change your default mask so that the default permission is 644. What is the default permission for directories after you make this change? vi ~/.bashrc append/modify following line to setup a new umask:
 umask 644 Save and close the file. Changes will take effect after next login.Default is 133
Check the default permission for the garbage directory? Has it been changed after setting the default mask? Why or why not? ls -ld garbage ,no change in permission because older file don’t get changed only new files are affected
Delete this directory : rm -rf garbage
Create a directory called fred under the session2 directory : mkdir session2/fred
Check the permission of this directory and make a note of it : ls -ld session2/fred d—x-wx-wx
Remove the x permission for this directory: chmod -033 session2/fred
Move to the session2 directory. You should have a problem. Do you know what the problem is? Fix the problem. cd session2/fred fred is unaccessable now. cd session2 then use chmod -R 133 fred to resolve it
Create a file called helpme under this directory: vi helpme
Put the following information into the helpme file
Fred Flintstone
Wilma Flintstone
Barney Rubble
Betty Rubble
Pebbles
Bam-Bam
Save this file: press i and then paste
Fred Flintstone
Wilma Flintstone
Barney Rubble
Betty Rubble
Pebbles
Bam-Bam
press esc shift +; and write wq! and enter to save file.
Rename this file to flintstones.txt: mv helpme flintstones.txt
Check the permissions of this file. Can users in your group copy this file? Can they change it? Can users outside your group copy this file? Can they change this file? Is this file executable?
Change the permissions of this file so that every user can read, modify but not execute this file:
ls -ld flintstones.txt No users cannot copy this file.No they cannot change this file.No user outrside group can not change file. No they cannot change file.No its not executable.
chmod 666 flintstones.txt



