IT 244: Introduction to Linux/Unix
Homework 5
Due Sunday, February 25th at 11:59 PM
All this work should be done on users3.cs.umb.edu
Deliverables
-
A shell script named hw5.sh that performs the operations listed below.
This file should be in an hw5 directory inside your
hw directory inside your it244 directory.
100 points
Requirements
- Create an hw5 directory in your hw directory
inside your it244 directory
- Go to the hw5 directory and run Unix commands that will execute the steps below
- When you have a command line that does what the step asks you to do, paste it into
hw5.sh using
nano
or any other text editor
- When you have completed all the steps, create an
echo
statement before the commands
for each step, that will print the step number to the terminal
Testing
- The script hw5.sh must have the format specified in
this document
- Scripts that do not follow the rules specified in the document mentioned above will
will have points deducted from their score
- Be sure to test your script and correct any errors you find
- You will lose 5 points for each error that occurs when running your script
- To run your script and see only the error messages run the following command
bash hw5.sh > /dev/null
- If you test your script more than once, you will have to remove the directories and
the link you created in your hw5 directory
or you will get error messages when your script tries to create them a second time.
Steps for Script
-
Create a file named work.sh in your hw5 directory.
Give this file read and write permission (no execute permissions) for you alone.
No other account should have any access privileges to this file.
Show the access permissions of this file.
-
Change the permissions on the work.sh file so you have read
and write permissions.
Give everybody else, including the group, read permissions only.
Show the access permissions of this file.
-
Give yourself read, write and execute permissions to the file work.sh.
Give everyone else, including the group, execute permissions only.
Show the access permissions of this file.
-
Create a directory named dir1 in your hw5 directory.
Give all users, including the group, read, write and execute access to this directory.
Show the permissions on this directory.
-
Create a directory named dir2 in your hw5 directory.
Give yourself read, write and execute permissions on this directory.
Give the group and everyone else only those permissions which will let them run ls
on this directory,
but nothing else.
Show the permissions on this directory.
-
Create a directory named dir3 in your hw5 directory.
Give yourself full permissions to this directory.
Give only the group the ability to run ls on this directory and to cd
into it.
Give everyone else no privileges on this directory.
Show the permissions on this directory.
-
Make sure you are in your hw5 directory.
Create a symbolic link named homework
in your current directory to your hw directory.
Show the permissions on this link.
-
Use the homework link you just created
to go to your hw directory.
Show me you are in the correct location.
-
Go back to your hw5 directory.
Show the true location of this directory in the /courses hierarchy.
-
Go to your home directory.
Perform a long listing to see the absolute pathname of your it244 directory.
cd
into this directory using an absolute pathname.
This pathname must include the /courses directory.
Show your new location.