% CST8207 Week 02 Notes -- the shell, arguments and options, man pages % Ian! D. Allen -- -- [www.idallen.com] % Fall 2017 - September to December 2017 - Updated 2017-10-01 17:22 EDT - [Course Home Page] - [Course Outline] - [All Weeks] - [Plain Text] Class Representative Elections, Meetings, and Program Councils ============================================================== You will elect a student Class Representative from among your classmates in each of your CST8207 theory classes on Monday September 11 (section 010 and 030) or Tuesday September 12 (section 020). (That's one student representative elected in each section.) Students who would like to be candidates for election must be ready to put forward their names in their CST8207 theory class on Monday or Tuesday this week (Week 3). Details about why this position is important may be found in the [Class Representative Job Description PDF]. You may also examine all the [related documents]. Readings, Assignments, Labs, Tests, and ToDo ============================================ Read (at least) these things (All The Words) -------------------------------------------- 1. [Week 02 Notes HTML] -- this file -- **Read All The Words** 2. [File Transfer] -- File transfer to/from Unix/Linux machines. You need this to upload your assignments for marking. 3. [The Unix/Linux Shell] -- using the shell command line in Linux 4. [Command Arguments and Options] 5. [Finding Help in Manual Pages -- RTFM] 6. For next week: [File System and Pathnames] -- ROOT, absolute, relative, dot, dot dot 7. [List of Commands You Should Know] 8. [Linux and Sysadmin News in the World] - Create your [lynda.com] account and watch these sections of [Unix for Mac OS X Users] - these videos are for *all* Unix/Linux students, not just Mac OSX users - **Introduction** - Introduction 1m 10s - **Ch.1. Introduction to Unix** - What is Unix 7m 27s - Logging in and using the command prompt 5m 19s - Ignore the Mac-specific menus, user information, and shortcuts - Command Structure 5m 22s - command names, options, and arguments - Kernels and shells 5m 25s - the O/S core vs. the shell programs that read your command line - Unix manual pages 4m 6s - `man` - how to get help on every Unix/Linux command name - some say this is "the most valuable movie", "your best friend" - **3. Working with Files and Directories** - Naming files 5m 41s - Unix is case-sensitive, OSX is case-insensitive! - avoid special characters or blanks in Unix pathnames Assignments this week --------------------- Check the due date for each assignment and put a reminder in your agenda, calendar, and digital assistant. Just like in the Real World, not all due dates are on the same days or at the same times. - Review last week. Did you do everything assigned last week? - Read All The Words, Do, and then Submit via Blackboard: - [Assignment #01 HTML] -- Multi-tasking and Schoolwork - [Assignment #02 HTML] -- Course Linux Server simple commands - Really do **Read All The Words**. You don't get a second chance to get it right. Lab work this week ------------------ - Last week, your instructor showed you how to log in to the [Course Linux Server] and use some simple commands. This week, you will create a file and then transfer the file to your laptop and upload it to Blackboard. - [Assignment #02 HTML] will have you log in to the CLS, do some simple commands with output redirection, and change your CLS password. - After you finish the above assignments, read [File System and Pathnames]. - If you understand pathnames, start work on the first two worksheets. - You need to understand the worksheets for your next assignments. ### Worksheets Worksheets are preparation for your assignments. You can't do the assignments without having done the worksheets first, and you can't do the worksheets without having first read the Course Notes: 1. Read. 2. Worksheet. 3. Assignment. Form a small study group to do the worksheets. Each person tries the example given, and you make sure you all get the same answers. Worksheets are not for hand-in; they are not worth marks; the assignments test your knowledge of the lectures and worksheets. > The worksheets are available in four formats: Open Office (ODT), PDF, HTML, > and Text. Only the Open Office format allows you "fill in the blanks" in > the worksheet. The PDF format looks good but doesn't allow you to type into > the blanks in the worksheet. The HTML format is crude but useful for quick > for viewing online. Do **NOT** open the Worksheet ODT files using any Microsoft products; they will mangle the format and mis-number the questions. Use the free Libre Office or Open Office programs to open these ODT documents. On campus, you can [download Libre Office here]. These first two worksheets require you to have read [File System and Pathnames]: - [Worksheet #02 ODT] -- Using standard Linux commands I - [Worksheet #02 PDF] - [Worksheet #02 HTML] - `PS1, cd, find, less, ls, man, mkdir, passwd, pwd, rmdir` - [Worksheet #03 ODT] -- Using standard Linux commands II - [Worksheet #03 PDF] - [Worksheet #03 HTML] - `cat, clear, cp, find, fgrep, history, less, man, mv, rm, sleep, touch` Worksheets prepare you for the upcoming assignments. Upcoming tests -------------- For full marks, read the [Test Instructions] (all the words) before your midterm tests. Use the [Algonquin Registered Name Game] link to test your name before the test. I don't answer questions about the instructions during the test. 1. First Midterm test: 45 minutes; in your one-hour lecture class on Thursday or Friday in Week 5 (October 5 or 6). 2. Second Midterm test: 45 minutes; in your one-hour lecture class on Thursday or Friday in Week 9 (November 2 or 3). Tests take place in your 50-minute lecture class, not in your lab period. Each midterm test is 45 minutes long and contains approximately 45 multiple-choice questions similar to those found in \[Practice Tests and Answers\]. You must write the test in the lecture class in which you are registered. ### Midterm Test #1 -- October 5 or 6 - Midterm #1 takes place on Thursday or Friday, October 5 or 6 (Week 5), in your scheduled lecture class (not in your lab period). - For full marks, you must read the [Test Instructions] before the test for important directions on how to enter your name, student number, answers, your lab (not lecture) section number, and the test version code on the question sheet and the mark-sense forms. - There may be more questions on the test than you can answer in the time allowed; answer the ones you know, first. - I will post a set of practice questions and quizzes for the test soon. Notes from the Classroom ======================== - **Take notes in class!** Keep a pad open on your desk. - This week in lecture we learn about the terminal, the shell, simple output redirection, and using pathnames, especially relative pathnames. - Keep a notebook with a [List of Commands][List of Commands You Should Know] in it. - You need to write down yourself what each command *does*. - Basic EMail etiquette: - Make the **Subject:** match the message. - Don't quote irrelevant crap in replies; remove the junk. - [Don't top-post] unless forwarding. - Navigating Blackboard and the Course Notes: - always open links in tabs; do not click through or you'll get lost - know how to hide and un-hide the Blackboard course menu - configure "All" for Blackboard My Announcements and My Calendar dates - Used in class and lab this week: - *more to come here...* Fifteen minute rule: don't waste your time ------------------------------------------ See the [Course Introduction: fifteen minute rule] Course Linux Server (CLS) account no login ------------------------------------------ As of 3am Monday September 11, 57 students still have not logged in to the [Course Linux Server]. You will need to know how to log in to work on [Assignment #02 HTML] this week. See your lab instructor for help reading all the words. Locked out of the Course Linux Server ------------------------------------- As I said last week, if you typed your CLS userid or password incorrectly more than about three times, you got your IP address locked out: Sep 7 15:29:38 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:30:15 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:31:33 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:31:40 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:31:49 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:32:21 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:35:07 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:40:08 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:40:31 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:40:56 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:41:14 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:41:34 Failed password for XXXXXXXX from *.dsl.bell.ca Sep 7 15:48:33 refused connect Sep 8 21:13:39 Invalid user XXXXXXXX (upper-case letter!) Sep 8 21:14:41 Failed none for invalid user Sep 8 23:32:49 Invalid user XXXXXXXX Sep 8 23:33:12 Failed password for invalid user XXXXXXXX Sep 8 23:33:30 Failed password for invalid user XXXXXXXX Sep 8 23:33:44 Failed password for invalid user XXXXXXXX Sep 8 23:34:53 refused connect Sep 9 23:13:34 Invalid user XXXXXXX (only 7 characters!) Sep 9 23:13:48 Failed password for invalid user XXXXXXX Sep 9 23:14:14 Failed password for invalid user XXXXXXX Sep 9 23:14:42 Failed password for invalid user XXXXXXX Sep 9 23:14:51 Failed password for invalid user XXXXXXX Sep 9 23:17:27 Invalid user XXXXXXX Sep 9 23:17:43 Failed password for invalid user XXXXXXX Sep 9 23:18:04 Failed password for invalid user XXXXXXX Sep 9 23:18:18 Failed password for invalid user XXXXXXX Sep 9 23:20:00 refused connect Sep 11 01:53:05 Invalid user david Sep 11 01:53:19 Failed password for invalid user david Sep 11 01:53:38 Failed password for invalid user david Sep 11 01:53:51 Failed password for invalid user david Sep 11 01:54:28 Invalid user david Sep 11 01:55:04 Failed password for invalid user david Sep 11 01:56:44 refused connect When you are locked out, [follow the directions] in [Course Linux Server] for finding out your real IP address and getting it unblocked. Assignment #1: Read All The Words --------------------------------- - As of midnight Wednesday, 211 of 232 students had submitted [Assignment #01 HTML]. - 11 students used the wrong file name: Bad file name: Assignment 1.txt Bad file name: Multitasking.txt Bad file name: assignment 01 .txt Bad file name: assignment 1.txt Bad file name: assignment.txt Bad file name: assignment01.txt.txt Bad file name: assignment1.txt - 13 students did not use the exact numbering specified in the assignment. - 18 people used a word processor instead of Notepad, resulting in non-ASCII characters such as Microsoft "Smart Quotes" and Unicode instead of Plain Text. - Activity 2 in the Week 1 notes told you to [Turn off Smart Quotes] **Please Read All The Words.** Assignment #2: Done ------------------- As of midnight Wednesday September 14, 127 of 232 students have already finished [Assignment #02 HTML] with a 10/10 score. Course Linux Server under attack -------------------------------- The Course Linux Server \[CLS\] is on the open Internet, not hidden behind a firewall, and is subject to attacks on its SSH port by people looking to take over the machine. Our job as System Administrators is to prevent that from happening. In Fall 2016 (September through December 2016) the CLS received over 131,705 attacks on the SSH port, mostly from China. Here are the counts, IP addresses, and country codes of the machines that attacked the CLS more than 500 times last term: $ ./attack_whois.sh 82482 116.31.116.28 CN 18572 116.31.116.24 CN 13497 116.31.116.23 CN 1547 116.31.116.26 CN 966 68.55.78.69 US 545 221.194.47.229 CN 542 121.18.238.104 CN 532 221.194.47.249 CN 529 221.194.47.208 CN 526 221.194.47.224 CN 518 121.18.238.114 CN The above output is generated by a shell script that you will be able to write when you successfully complete CST8207. Here are the major attacks for the current term (Fall 2017): 11040 58.218.198.165 CN 5062 58.218.198.166 CN 3493 58.218.198.143 CN 2770 116.31.116.25 CN 522 84.141.23.5 DE Here are excerpts from attacks in the CLS authorization log file `/var/log/auth.log` this week: Sep 10 20:04:02 Invalid user homepage from 52.64.87.237 Sep 10 21:13:19 Invalid user admin from 71.84.119.143 Sep 10 21:13:20 Invalid user usuario from 71.84.119.143 Sep 11 01:21:44 Invalid user admin from 210.94.133.3 Sep 11 01:46:48 Invalid user pi from 211.248.11.169 Sep 11 05:13:35 Invalid user admin from 18.85.22.204 A `whois` lookup of IP address `210.94.133.3` shows that it is part of a network hosted in Seoul, Korea. `211.248.11.169` is also in Korea. Your careful work in CST8207 is critical to learning how to prevent these types of attacks from compromising the machines you control. Trying to use privileged commands on the CLS -------------------------------------------- No, you are not allowed to use privileged commands such as `sudo` or `su` on my Course Linux Server. Use your own Linux virtual machine if you want to play with those commands. Bruce Schneier on cyber attacks ------------------------------- *"For decades, hackers have used techniques such as jump hosts, VPNs, Tor and open relays to obscure their origin, and in many cases they work. I'm sure that many national intelligence agencies route their attacks through China, simply because everyone knows lots of attacks come from China."* Don't use the place-holder userid `abcd0001` -------------------------------------------- - Never use the sample userid *abcd0001* to log in. These are example userids used in the notes that are meant to be replaced with *your own login userid*. If you try repeatedly to log in to the [Course Linux Server] from home using a non-existent userid or password, your home IP address will be locked out; see the [Course Linux Server] notes for help on how to fix this. ![Take Notes in Class] -- | Ian! D. Allen, BA, MMath - 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/ [Course Home Page]: .. [Course Outline]: course_outline.pdf [All Weeks]: indexcgi.cgi [Plain Text]: week02notes.txt [Class Representative Job Description PDF]: class_rep/Class-Rep-Job-Description-2017-18.pdf [related documents]: class_rep/ [Week 02 Notes HTML]: week02notes.html [File Transfer]: 015_file_transfer.html [The Unix/Linux Shell]: 120_shell_basics.html [Command Arguments and Options]: 150_arguments_and_options.html [Finding Help in Manual Pages -- RTFM]: 140_man_page_RTFM.html [File System and Pathnames]: 160_pathnames.html [List of Commands You Should Know]: 900_unix_command_list.html [Linux and Sysadmin News in the World]: 950_linux_world.html [lynda.com]: http://algonquincollege.com/onlineresources/mobileStudent/lynda.htm [Unix for Mac OS X Users]: http://www.lynda.com/Mac-OS-X-10-6-tutorials/Unix-for-Mac-OS-X-Users/78546-2.html [Assignment #01 HTML]: assignment01.html [Assignment #02 HTML]: assignment02.html [Course Linux Server]: 070_course_linux_server.html [download Libre Office here]: 050_course_introduction.html#install-libreoffice-or-openoffice-into-windows [Worksheet #02 ODT]: worksheet02.odt [Worksheet #02 PDF]: worksheet02.pdf [Worksheet #02 HTML]: worksheet02.html [Worksheet #03 ODT]: worksheet03.odt [Worksheet #03 PDF]: worksheet03.pdf [Worksheet #03 HTML]: worksheet03.html [Test Instructions]: 000_test_instructions.html [Algonquin Registered Name Game]: http://cst8207.idallen.ca/~idallen/namegame.cgi [Don't top-post]: http://idallen.com/topposting.html [Course Introduction: fifteen minute rule]: 050_course_introduction.html#fifteen-minute-rule-dont-waste-your-time [follow the directions]: 070_course_linux_server.html#getting-locked-out-of-the-server [Turn off Smart Quotes]: 050_course_introduction.html#turn-off-smart-quotes-for-linux-work [Take Notes in Class]: data/remember.jpg "Take Notes in Class" [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/