IT 244: Introduction to Linux/Unix
Homework 5
Due
Sunday, October 6th at 11:59 PM
What You Need to Do
- Create the script hw5.sh
with Unix commands that will do what is described in the steps
below
- This file must be in an hw5
directory under your hw directory
Setup
-
From your home directory go to your it244
directory
cd it244
- Go to your hw directory
cd hw
- Create an hw5 directory
mkdir hw5
- Enter this new directory
cd hw5
- Create hw5.sh
nano hw5.sh
You Must Use Numeric Format When Using chmod
- The
chmod
command is used to change the
permissions on a file or directory
- You can specify the permissions to be given with digits,
like 755, or characters
- You MUST use digits in this assignment
- The character, or symbolic method, take too much time
for me to score
Specification
- Create the file hw5.sh inside
your hw5 directory using
nano
- Write the Unix command to perform the action specified
by each step
- Be sure to write a Step comment before the Unix
commands for each step
-
Using
touch
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.
-
Change the permissions on the work.sh file so you have read
and write permissions.
Give everybody else, including the group, read permissions only.
-
Give yourself read, write and execute permissions to the file work.sh.
Give everyone else, including the group, execute permissions only.
-
Create a directory named dir1 in your hw5 directory.
Give all users read, write and execute access to 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.
-
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.
-
You should be in your hw5 directory.
Create a symbolic link named homework
in your current directory to your hw directory.
-
Use the homework link you just created
to go to your hw directory.
-
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.
Testing
- There are two tests that your should run on your script
- The first test checks for Unix errors
- Run bash on your script like this
bash hw5.sh > /dev/null
- If you run this command a second time, you will get
the following error messages, which you can ignore
mkdir: cannot create directory ‘dir1’: File exists
mkdir: cannot create directory ‘dir2’: File exists
mkdir: cannot create directory ‘dir3’: File exists
- This will run your script but will only show error
messages
- If you see nothing, your script has passed this test
- The second test checks your Step comments
- Run it like this
~ghoffman/code/it244_code/testing_scripts_it244/step_comment_check.sh
- If your Step comments are wrong you will lose points
Copyright © 2020 Glenn Hoffman. All rights reserved. May not be reproduced without permission.