Updated: 2013-06-08 15:44 EDT

1 Due Date and DeliverablesIndexup to index

WARNING: Some inattentive students upload Assignment #10 into the Assignment #9 upload area. Don’t make that mistake! Be exact.

2 Purpose of this AssignmentIndexup to index

This assignment is based on your weekly Class Notes.

  1. Practice controlling Processes and Jobs.
  2. Search System Log Files.
  3. Schedule jobs using Crontab and At.
  4. Install Fedora 12 before the next assignment.

3 Introduction and OverviewIndexup to index

This is an overview of how you are expected to complete this assignment. Read all the words before you start working.

Complete the Tasks listed below on the Course Linux Server (CLS). Check your work using the given examples. Run a Checking Program to verify your work after you have run your own tests. Submit the output of the checking script to Blackboard before the due date.

Practice controlling Processes and Jobs.

Search System Log Files.

Schedule jobs using Crontab and At.

Install Fedora 12 and check it using Lab Worksheet #07 PDF.

3.1 The Source DirectoryIndexup to index

All references to the “Source Directory” below are to the directory ~idallen/cst8207/13w/assignment10/ and that name starts with a tilde character “~” followed by a userid with no intervening slash. The leading tilde indicates to the shell that the pathname starts with the HOME directory of the account idallen.

4 TasksIndexup to index

4.1 Set UpIndexup to index

  1. Create the following directory structure in your CLS HOME directory and record (for study purposes) the series of Unix commands you used to create it. Spelling and capitalization must be exactly as shown:

    CST8207-13W/
    `-- Assignments
        `-- assignment10

    This directory is the base directory for most pathnames in this assignment. Store your files and answers here.

  2. There is a Checking Program named assignment10check in the Source Directory on the CLS. Follow the instructions in the first two steps at the start of Checking Program to create a working symbolic link to this program.

4.2 Part A - Process ListingIndexup to index

Review Processes and Jobs.

  1. Place a full list of all processes for all users, BSD format, all users, text user name (not numeric UID), full wide listing (not truncated at all), into file psbsd.txt in your assignment10 directory. It should be “at least” 105 lines and 9KB. One of the very long lines will look similar to this (use grep to find it in the output):

    root 1104 0.0 0.0 7264 612 ? Ss Mar24 0:00 dhclient3 -e IF_METRIC=9999 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -1 eth0
  2. Place a full list of all processes for all users, UNIX format, all users, text user name (not numeric UID), full wide listing (not truncated at all), into file psunix.txt in your assignment10 directory. It should be “at least” 105 lines and 7KB. One of the very long lines will look similar to this (use grep to find it in the output):

    root 1104 1 0 Mar24 ? 00:00:00 dhclient3 -e IF_METRIC=9999 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -1 eth0

4.3 Part B - System Log FilesIndexup to index

Review System Log Files.

  1. What is the actual name of the syslog program on the CLS? Extract the one line from each file psbsd.txt and psunix.txt that contains this name and redirect the results (two lines, one from each file) into file syslog.txt. (The result will be 2 lines, 21 words.)

  2. The system authentication log file is named auth.log in the system log directory. Generate an ls long listing of this file using the full absolute pathname, and put the results into file authlog.txt. (The result will be 1 line, 9 words, at least 65 characters.)

    (Optional: You may find it convenient to set a shell variable to this absolute pathname, so that you can use the short variable name rather than the long absolute pathname in the rest of these exercises. Or, you could make a short symbolic link to this file.)

  3. Put a list (one line) of your userid, UID, group, GID, and additional groups into the file id.txt. (The result will be 1 line, 3 words.) (See Permissions for the command to use to do this.)

  4. Look at the contents of the id.txt and authlog.txt files. Note that your account is in a group that matches the group of the system auth.log file, giving you group permissions on this file. Using a text editor, put the matching group name (three characters), the symbolic group permissions (three characters), and the octal group permissions (one digit), onto three lines in file myperms.txt. (The result will be 3 lines, 3 words, 10 characters, checksum 05812. Do you remember why a file containing seven alphanumeric characters on three lines is counted as a 10-character file?)

  5. The system auth.log file contains over 1,760,000 lines. Use a command to extract just the first line (one line) from the head of this file and redirect that one line into new file authhead.txt. (The result will be 1 line 14 words 108 chars, checksum 32111.) The time and date at the start of this line is when this copy of the log file was started.

  6. Use a command or command pipeline (maximum two commands) to count the number of lines in auth.log containing the exact text Failed password and redirect the count (just one number) into file failedpass.txt. The count is more than 2,870 lines! The new output file failedpass.txt will contain a single number: one line, one word.

  7. The file /etc/hosts.evil contains the IP addresses of machines that have tried to break into the CLS. The CLS is running the denyhosts package to blacklist attacking machines. Pick the first IP address out of hosts.evil and search for it in the auth.log file to find out why it was blacklisted. Redirect the output into file badhost.txt. (The result will be 6 lines 78 words 694 chars.)

Feel free to explore all the other attacking IP addresses to learn what it’s like having a machine exposed on the Internet.

4.4 Part C - Crontab and At SchedulingIndexup to index

Review Crontab and At.

  1. Create a personal crontab entry that updates the modification time on file crontab.txt (in your assignment10 directory, not in your HOME directory) every minute of every day. (Use the shortest relative pathname to your crontab.txt file. Do not use an absolute pathname.) Verify that the modification time of the file changes every minute.

  2. List your personal crontab and redirect the output into file crontab1.txt.

  3. Delete your personal crontab.

  4. Create a personal crontab entry that updates the modification time on the same file crontab.txt at exactly 7:34 PM every evening. (Also use a relative pathname, not an absolute pathname.)

  5. List your personal crontab and redirect the output into file crontab2.txt. Do not delete this crontab entry; leave it for marking.

  6. Create an at job that updates the modification time on the file atjob.txt (in your assignment10 directory, not in your HOME directory) one minute from now. (Check the current time and add a minute.) Make sure that the file time changes one minute from now.

  7. Create an at job that updates the modification time on the file atjob.txt (in your assignment10 directory, not in your HOME directory) at the start date and time of your CST8207 final exam. Leave this job queued on the CLS for marking.

  8. Display all your queued at jobs and redirect the output into file atjob.txt. (You will only have one job - one line.)

4.5 Part D - Fedora Installation CheckIndexup to index

  1. Have your instructor check you off on the Fedora installation using the five points on the last page of Lab Worksheet #07 PDF.

4.6 When you are doneIndexup to index

That is all the tasks you need to do.

Check your work a final time using the Checking Program and save the output as described below. Submit your mark following the directions below.

5 Checking, Marking, and Submitting your WorkIndexup to index

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.

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 marks file to Blackboard.

  1. There is a Checking Program named assignment10check in the Source Directory on the CLS. Create a Symbolic Link to this program named check under your new assignment10 directory so that you can easily run the program to check your work and assign your work a mark. Note: You can create a symbolic link to this executable program but you do not have permission to read or copy the program file.

  2. Execute the above “check” program using its new symbolic link. (Review the Search Path notes if you forget how to run a program by pathname from the command line.) This program will check your work, assign you a mark, and display the output on your screen. (You may want to paginate the long output so you can read all of it.)

    You may run the “check” program as many times as you wish, to correct mistakes and get the best mark. Some tasks 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 checking this assignment, and you like what you see on your screen, redirect the output of the Checking Program into the text file assignment10.txt under your assignment10 directory. Use the exact name assignment10.txt in your assignment10 directory. You only get one chance to get the name correct. Case (upper/lower case letters) matters. Be absolutely accurate, as if your marks depended on it. Do not edit the file.

  4. Transfer the above assignment10.txt file from the CLS to your local computer and verify its contents. Do not edit this file! No empty files, please! Edited or damaged files will not be marked. You may want to refer to your File Transfer notes.

  5. Submit the assignment10.txt file under the correct Assignment area on Blackboard (with the exact name) before the due date. Upload the file via the assignment10 “Upload Assignment” facility in Blackboard: click on the underlined assignment10 link in Blackboard. Use “Attach File” and “Submit” to upload your plain text file.

    No word-processor documents. Do not send email. Use only “Attach File”. Do not enter any text into the Submission or Comments boxes on Blackboard; I do not read them. Use only the “Attach File” section followed by the Submit button. (If you want to send me comments about your assignment, use email.)

  6. Your instructor may also mark the assignment10 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!

Use the exact file name given above. Upload only one single file of plain text, not HTML, not MSWord. No fonts, no word-processing. Plain text only.

Did I mention that the format is plain text (suitable for VIM/Nano/Pico/Gedit or Notepad)?

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 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!

Author: 
| 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

Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen