Handed out Tuesday, February 23, 2016
Due 5:00 PM, Thursday, February 25, 2016
The following exercises are designed to give you exposure to various POSIX commands that can be used to set/change permissions. Log on to the virtual dev box as user httpd to get started. Answer the following questions in a text file.
At the terminal, do
$ mkdir ~/hw2 && cd ~/hw2 $ echo 'hello' > a.file $ ls -l a.file $ stat a.fileQuestion 1: What are the permissions set to for this file?
Now do
$ cat a.file $ chmod 000 a.fileQuestion 2: After you have run the chmod command, what will be the behavior of cat?
# Notice how even though you don't have write permissions, # you can still remove the file: $ rm a.file $Question 3: Why is this allowed? What structure does rm modify?
$ rm -f * $ echo "Though this be madness, yet there is method in't." > h2.2 $ ls -l h2.2 $ chmod g-w h2.2 $ chmod o-rwx h2.2 $ sudo chown irc: h2.2Question 4: What is the current state of the file: Who can edit it? Who can read it?
$ sudo chown httpd:irc h2.2Question 5: Now what is the state of the file? What has changed about its state from the previous question?
$ mkdir restrict $ ln h2.2 restrict/secret $ ls -l # Notice the first letter in the bits indicates restrict is # a directory, not a file. Further, notice how all of the # executable bits are set. $ chmod -x restrict $ ls -l restrictQuestion 6: What happens if I try to cd into restrict? What about editing the restrict/secret file?
Use NYU Classes; there's an entry for this homework.
Last updated: 2016-04-15 16:24:03 -0400 [validate xhtml]