% CST8207 Assignment 10 – setting permissions, mode, `umask` % Ian! D. Allen – – [www.idallen.com] % Winter 2015 - January to Apil 2015 - Updated Mon Mar 23 17:08:24 EDT 2015 Due Date and Deliverables ========================= > **Do not print this assignment on paper!** > > - On paper, you will miss updates, corrections, and hints added to the > online version. > - On paper, you cannot follow any of the [hyperlink URLs] that lead you > to hints and course notes relevant to answering a question. > - On paper, scrolling text boxes will be cut off and not print properly. - **Due Date**: `15h00 (3pm) Tuesday March 31, 2015 (start of Week 12)` - Late assignments or wrong file names may not be marked. Please be accurate and punctual. - **Available online** - Version 1 – 14:00 March 17, 2015 - Version 2 – 14:00 March 23, 2015 – due date extended, above - **Prerequisites** - All [Class Notes][hyperlink URLs] since the beginning of term. - All your previous [Assignments] and [Worksheets]. - Practice with [Permissions] in [Lab Worksheet #08 HTML] - An ability to **READ ALL THE WORDS** to work effectively. - **Deliverables** 1. One plain text file uploaded to Blackboard according to the steps in the [Checking Program] section below. 2. Directory structure and files created and left for marking on the [Course Linux Server] (**CLS**).\ **Do not delete any assignment work from the CLS until after the term is over!** **WARNING:** Some inattentive students upload Assignment #10 into the Assignment #09 upload area. Don’t make that mistake! Be exact. Purpose of this Assignment ========================== > **Do not print this assignment on paper!** On paper, you cannot follow any > of the hyperlink URLs that lead you to hints and course notes relevant to > answering a question. This assignment is based on your weekly [Class Notes]. 1. Practice with [Permissions] in [Lab Worksheet #08 HTML] 2. Practice setting [Umask]. Remember to **READ ALL THE WORDS** to work effectively and not waste time. Introduction and Overview ========================= This is an overview of how you are expected to complete this assignment. Read all the words before you start working. For full marks, follow these directions exactly. 1. Complete the **Tasks** listed below. 2. Verify your own work before running the **Checking Program**. 3. Run the **Checking Program** to help you find errors. 4. Submit the output of the **Checking Program** to Blackboard before the due date. 5. **READ ALL THE WORDS** to work effectively and not waste time. You will create file system structure in your CLS home directory containing various directories and files. You can use the **Checking Program** to check your work as you do the tasks. You can check your work with the **Checking Program** as often as you like before you submit your final mark. **Some task sections below require you to finish the whole section before running the **Checking Program**; you may not always be able to run the **Checking Program** successfully after every single task step.** When you are finished the tasks, leave the files and directories in place on the CLS as part of your deliverables. **Do not delete any assignment work until after the term is over!** Assignments may be re-marked at any time on the CLS; you must have your term work available on the CLS right until term end. > Since I also do manual marking of student assignments, your final mark may > not be the same as the mark submitted using the current version of the > **Checking Program**. I do not guarantee that any version of the **Checking > Program** will find all the errors in your work. Complete your assignments > according to the specifications, not according to the incomplete set of the > mistakes detected by the **Checking Program**. The Source Directory -------------------- All references to the **Source Directory** below are to the CLS directory `~idallen/cst8207/15w/assignment10/` and that name starts with a *tilde* character `~` followed by a user name with no intervening slash. The leading tilde indicates to the shell that the pathname starts with the HOME directory of the account `idallen` (seven letters). You do not have permission to list the names of all the files in the Source Directory, but you can access any files whose names you already know. Searching the course notes on the CLS ------------------------------------- All course notes are available on the Internet and also on the CLS. You can learn about how to read and search these CLS files using the command line on the CLS under the heading *Copies of the CST8207 course notes* near the bottom of the page [Course Linux Server]. Tasks ===== - Do the following tasks in order, from top to bottom. - These tasks must be done in your account on the [Course Linux Server]. - **READ ALL THE WORDS!** and do not skip steps. - Run the **Checking Program** to grade your work, then upload the file containing the output of the **Checking Program** to Blackboard. - Your instructor will also mark on the due date the work you do in your account on the CLS. Leave all your work on the CLS and do not modify it. - **Do not delete any assignment work from the CLS until after the course is over.** Set Up – The Base Directory on the CLS -------------------------------------- > You must keep a list of command names used each week and write down what > each command does, as described in the [List of Commands You Should > Know]. Without that list to remind you what command names to use, you > will find assignments very difficult. 1. Do a [Remote Login] to the [Course Linux Server] (**CLS**) from any existing computer, using the host name appropriate for whether you are on-campus or off-campus. 2. Make the CLS directory `~/CST8207-15W/Assignments/assignment10` in which you will create the files and scripts resulting from the following tasks. 3. Create the `check` symbolic link needed to run the **Checking Program**, as described in the section [Checking Program] below. **This `assignment10` directory is called the [Base Directory] for most pathnames in this assignment. Store your files and answers in this [Base Directory], not in your HOME directory or anywhere else.** Use the symbolic link to run the [Checking Program] to verify your work so far. Part A – A file to record your permissions ------------------------------------------ You need to understand [Permissions] for this task. You will need to record the permissions you set on each of the directories and files you create in the next Part, below. You will record these permissions by copying and editing a file that you get from your instructor. You can record each of the permissions as you create things step-by-step below, or you can record all of the permissions after you have finished, before you run the checking program. 1. Copy the file `record.txt` from the [Source Directory] into your own file `abcd0001``.txt` (no spaces) where the text *abcd0001* is replaced by your *own* eight-character userid in the file name. This file copy should be located directly under your [Base Directory]. 2. Fix the permissions on the file so that you can edit it and nobody else (group or other) has any permissions at all. 3. As you work on the next Part below, edit your copy of the file with a text editor. (The `vim` editor is recommended, since that is the universal text editor for system administrators.) *Replace* each string of three underscores in the file with the correct three-digit numeric (octal) permission value that you record in the next Part below. Do not change anything else in the file. Note the word count at the bottom of the file. Your count must match exactly, at all times. If not, re-copy the file and start over. Part B – Creating structure with permissions -------------------------------------------- You need to understand [Permissions] for this task. Do the permissions section of [Lab Worksheet #08 ODT] before continuing. Record all your answers for later quizzes. Now you will create some directories and files, then set the correct permissions on them. The permissions to set are described below. > **Because you are applying permissions to directories as a > non-`root` user, be careful not to lock yourself out of > directories by restricting permissions on them too soon.** First, create > all the file and directory structure from the top of the directory tree > down, and then apply restrictive permissions afterward from the bottom of > the tree upward, after you have created all the structure. > > If you don’t apply permissions last, from the bottom up, you will deny > yourself permissions that will prevent you from entering some directories > lower down. **Assign permissions from the bottom toward the top.** Make sure you create directories where directories are required and files where files are required. 1. Create a directory named `head` under your [Base Directory]: a) Directory `head` has no permissions for others. The group can use `ls` to see the content, but cannot create files or `cd` into the directory. The user has full permissions. Record the permissions for `head` in the Record file. 2. Underneath directory `head` create three three-letter *directories* named: `usr grp oth` a) Directory `usr` has no permissions for group or other. The user can `cd` into it, but cannot create any new content nor use `ls` to see any files in it. Record the permissions. b) Directory `grp` has no permissions for user or other. The group can `cd` into it and use `ls` in it, but cannot create any new content. Record the permissions. c) Directory `oth` has no permissions for user or group. Others have full permissions. Record the permissions. 3. Underneath directory `usr` create three two-letter *files* named: `rd wr xc` a) None of the files have any permissions for group or other. b) File `rd` has read permission (only) for the user. Record the permissions. c) File `wr` has write permission (only) for the user. Record the permissions. d) File `xc` has execute permission (only) for the user. Record the permissions. 4. Underneath directory `grp` create three two-letter *files* named: `rw wx rx` a) None of the files have any permissions for user or other. b) File `rw` has read and write permission (only) for the group. Record the permissions. c) File `wx` has write and execute permission (only) for the group. Record the permissions. d) File `rx` has read and execute permission (only) for the group. Record the permissions. 5. Underneath directory `oth` create three three-character *files* named: `rwx ??? ***` *(Some characters are meta-characters that are special to the shell and will need careful handling. See the [Class Notes] about [Quoting].)* a) None of the files have any permissions for user or group. b) File `rwx` has full permissions for other. Record the permissions. c) File `???` has no permissions for other. Record the permissions. d) File `***` has only read permission for other. Record the permissions. Remember to read all the words above about working from top to bottom and then from bottom to top in this Part. Run the [Checking Program] to verify your work so far. Part C – Minimal Permissions ---------------------------- You need to understand [Permissions] for this task. Do the permissions section of [Lab Worksheet #08 ODT] before continuing. Record all your answers for later quizzes. Put the text below into file `minimal.txt` and replace *all* the sets of three underscore characters using your answers from [Worksheet #08][Lab Worksheet #08 HTML]. Missing permissions should be given as dashes so that each set of three underscores is replaced with exactly three other characters: *** Table of MINIMUM rwx symbolic permissions *** 1. copy a file: srcdir=___ srcfile=___ targetdir=___ 2. move a file: srcdir=___ srcfile=___ targetdir=___ 3. link to a file: srcdir=___ srcfile=___ targetdir=___ 4. delete a file: srcdir=___ srcfile=___ 5. read a file: srcdir=___ srcfile=___ 6. modify an existing file: dir=___ oldfile=___ 7. create a new file: dir=___ - The original file and the edited file must both have 8 lines and 55 words. - Every set of three underscores must be replaced with three permissions characters, as explained in the [Summary of `rwx` permissions]. - You can get a copy of the file from the [Source Directory]. - In #6, the word “modify” should be understood to mean “overwrite” or “append to”. No reading is required. Run the [Checking Program] to verify your work so far. Part D – Using `umask` to mask default permissions -------------------------------------------------- You need to understand [Umask] for this task. Do the `umask` section of [Lab Worksheet #08 ODT] before continuing. Record all your answers for later quizzes. 1. Use a text editor to create and edit the file `umask.txt` in your [Base Directory]. The file should contain this content: 1. drwxrwxrwx is created with a umask 0___ 2. drwxrwxr-x is created with a umask 0___ 3. drwxr-xr-x is created with a umask 0___ 4. drwxr-xr-- is created with a umask 0___ 5. drwxr-x--- is created with a umask 0___ 6. drwxr----- is created with a umask 0___ 7. drwx------ is created with a umask 0___ 8. d--x------ is created with a umask 0___ 9. d--------- is created with a umask 0___ The file must have a word count of: `9 72 387 umask.txt` You can get a copy of the file from the [Source Directory]. 2. Edit the file and replace the three underscores `___` with the correct three-digit `umask` value that would result in each set of symbolic permissions for a new directory. (Check your work by setting your `umask` to the above value and then creating and examining the permissions of a new directory.) The finished file must have the exact above word count. All correct answers will give a file checksum of `61603`. Do *not* leave your `umask` set incorrectly after this exercise. Run the [Checking Program] to verify your work so far. When you are done ----------------- That is all the tasks you need to do. Check your work a final time using the [Checking Program] below and save the standard output of that program into a file as described below. Submit that file (and only that one file) to Blackboard following the directions below. When you are done, log out of the CLS before you close your laptop or close the PuTTY window, by using the shell `exit` command: $ exit Checking, Marking, and Submitting your Work =========================================== **Summary:** Do some tasks, then run the **Checking Program** to verify your work as you go. You can run the **Checking Program** as often as you want. When you have the best mark, upload the single file that is the output of the **Checking Program** to Blackboard. > Since I also do manual marking of student assignments, your final mark may > not be the same as the mark submitted using the current version of the > **Checking Program**. I do not guarantee that any version of the **Checking > Program** will find all the errors in your work. Complete your assignments > according to the specifications, not according to the incomplete set of the > mistakes detected by the **Checking Program**. 1. There is a **Checking Program** named `assignment10check` in the [Source Directory] on the CLS. You can execute this program by typing its (long) pathname into the shell as a command name: $ ~idallen/cst8207/15w/assignment10/assignment10check You learn one way to make this shorter in the current assignment. 2. Execute the above **Checking Program** as a command line on the CLS. This program will check your work, assign you a mark, and display the output on your screen. You may run the **Checking Program** as many times as you wish, allowing you to correct mistakes and get the best mark. **Some task sections require you to finish the whole section before running the Checking Program at the end; you may not always be able to run the Checking Program successfully after every single task step.** 3. When you are done with this assignment, and you like the mark displayed on your screen by the **Checking Program**, you must **redirect** only the standard output of the **Checking Program** into the text file `assignment10.txt` in your [Base Directory] on the CLS, like this: $ ~idallen/cst8207/15w/assignment10/assignment10check >assignment10.txt $ cat assignment10.txt - Use output redirection with that *exact* `assignment10.txt` file name. - Use that *exact* name. Case (upper/lower case letters) matters. - Be absolutely accurate, as if your marks depended on it. - Do not edit the output file. - Make sure the file actually contains the output of the **Checking Program**! - The file should contain, near the bottom, a line starting with: `YOUR MARK for` - Really! **MAKE SURE THE FILE HAS YOUR MARKS IN IT!** 4. Transfer the above single file `assignment10.txt` (containing the output from the **Checking Program**) from the CLS to your local computer. - You may want to refer to the [File Transfer] page for how to transfer the file. - Verify that the file still contains all the output from the **Checking Program**. - Do not edit this file! No empty files, please! Edited or damaged files will not be marked. Submit the file exactly as given. - The file should contain, near the bottom, a line starting with: `YOUR MARK for` - Really! **MAKE SURE THE FILE YOU UPLOAD HAS YOUR MARKS IN IT!** 5. Upload the `assignment10.txt` file from your local computer to the correct Assignment area on Blackboard (with the exact name) before the due date: 1. On your local computer use a web browser to log in to Blackboard and go to the Blackboard page for this course. 2. Go to the Blackboard *Assignments* area for the course, in the left side-bar menu, and find the current assignment. 3. Under *Assignments*, click on the underlined **assignment10** link for this assignment. a) If this is your first upload, the *Upload Assignment* page will open directly; skip the next sentence. b) If you have already uploaded previously, the *Review Submission History* page will be open and you must use the *Start New* button at the bottom of the page to get to the *Upload Assignment* page. 4. On the *Upload Assignment* page, scroll down and beside *Attach File* use *Browse My Computer* to find and attach your assignment file from your local computer. Make sure the assignment file has the correct name on your local computer before you attach it. 5. After you have attached the file on the *Upload Assignment* page, scroll down to the bottom of the page and use the *Submit* button to actually upload your attached assignment file to Blackboard. Use only *Attach File* on the *Upload Assignment* page. Do not enter any text into the *Text Submission* or *Comments* boxes on Blackboard; I do not read them. Use only the *Attach File* section followed by the *Submit* button. If you need to comment on any assignment submission, send me [EMail]. You can revise and upload the file more than once using the *Start New* button on the *Review Submission History* page to open a new *Upload Assignment* page. I only look at the most recent submission. You must upload the file with the correct name from your local computer; you cannot correct the name as you upload it to Blackboard. 6. **Verify that Blackboard has received your submission**: After using the *Submit* button, you will see a page titled *Review Submission History* that will show all your uploaded submissions for this assignment. Each of your submissions is called an *Attempt* on this page. A drop-down list of all your attempts is available. a) Verify that your latest *Attempt* has the correct 16-character, lower-case file name under the *SUBMISSION* heading. b) The one file name must be the *only* thing under the *SUBMISSION* heading. Only the one file name is allowed. c) No *COMMENTS* heading should be visible on the page. Do not enter any comments when you upload an assignment. d) **Save a screen capture** of the *Review Submission History* page on your local computer, showing the single uploaded file name listed under *SUBMISSION*. If you want to claim that you uploaded the file and Blackboard lost it, you will need this screen capture to prove that you actually uploaded the file. (To date, Blackboard has never lost an uploaded file.) You will also see the *Review Submission History* page any time you already have an assignment attempt uploaded and you click on the underlined **assignment10** link. You can use the *Start New* button on this page to re-upload your assignment as many times as you like. You cannot delete an assignment attempt, but you can always upload a new version. I only mark the latest version. 7. Your instructor may also mark files in your directory in your CLS account after the due date. Leave everything there on the CLS. **Do not delete any assignment work from the CLS until after the term is over!** - I do not accept any assignment submissions by EMail. Use only the Blackboard *Attach File*. No word processor documents. Plain Text only. - Use the *exact* file name given above. Upload only one single file of Linux-format plain text, not HTML, not RTF, not MSWord. No fonts, no word-processing. Linux plain text only. - **NO EMAIL, WORD PROCESSOR, PDF, RTF, or HTML DOCUMENTS ACCEPTED.** - No marks are awarded for submitting under the wrong assignment number or for using the wrong file name. Use the exact 16-character, lower-case name given above. - **WARNING:** Some inattentive students don’t read all these words. Don’t make that mistake! Be exact. **READ ALL THE WORDS. OH PLEASE, PLEASE, PLEASE READ ALL THE WORDS!** -- | Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/ [Plain Text] - plain text version of this page in [Pandoc Markdown] format [www.idallen.com]: http://www.idallen.com/ [hyperlink URLs]: indexcgi.cgi#Important_Notes__alphabetical_order_ [Assignments]: indexcgi.cgi#Assignments [Worksheets]: indexcgi.cgi#Worksheets__not_for_hand_in_ [Permissions]: 500_permissions.html [Lab Worksheet #08 HTML]: worksheet08.html [Checking Program]: #checking-marking-and-submitting-your-work [Course Linux Server]: 070_course_linux_server.html [Umask]: 510_umask.html [List of Commands You Should Know]: 900_unix_command_list.html [Remote Login]: 110_remote_login.html [Base Directory]: #set-up-the-base-directory-on-the-cls [Source Directory]: #the-source-directory [Lab Worksheet #08 ODT]: worksheet08.odt [Quoting]: 440_quotes.html [Summary of `rwx` permissions]: 500_permissions.html#summary-of-rwx-permissions [File Transfer]: 015_file_transfer.html [EMail]: mailto:idallen@idallen.ca [Plain Text]: assignment10.txt [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/