========================================================== Assignment #05 - .bashrc set-up and GLOB pattern challenge ========================================================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Read *all* the words in this assignment before you begin to type. Available online: Friday October 5, 2012 CLS: "Course Linux Server" Goals: Work with the Linux file system and GLOB patterns. Set up your sysadmin shell options in .bashrc and .bash_profile Learn file transfer from Linux to your local machine. Deliverables and due date: DUE: 8am on Tuesday October 16, 2012 Part A - create your .bashrc and .bash_profile Part B - extract some hidden cracker files on the CLS and - transfer and upload an "assignment05.txt" file. I will mark work in your account on the CLS. The DUE date applies. Do not delete this directory structure until after the term ends. Upload an assignment05.txt answer file before the DUE date. Late assignments or wrong file names may not be marked. Be accurate. Read Me First: Look in the Class Notes for Lab Worksheet 5 for help in completing this assignment. Do the weekly readings. *Be* a system tech! See also Bonus Worksheet 6 for more VIM practice. File Submission method: The upload file must have the *exact* name: assignment05.txt Upload the file via the assignment05 "Upload Assignment" facility in Blackboard in a manner similar to how you submitted the previous assignments (but upload under assignment05). Be exact! WARNING: Some inattentive students upload Assignment #5 into the Assignment #4 upload area. Don't make that mistake! Be exact. ============================================================================== Part A - sysadmin defaults -------------------------- See the Class Notes file on the VIM editor for help. A1. Print the recommended VIM reference card (front only). The one useful command missing from some cards is "redo": CTRL-R or ^R A2. Complete the "vimtutor" VIM tutorial (in any language). Make use of the front of the recommended VIM reference card. (See also Bonus Worksheet 6 for more VIM practice.) A3. Use VIM to create your ".bashrc" and ".bash_profile" files with the seven suggested shell options listed in the Course Note "Startup Files: .bash_profile and .bashrc". Also set your PS1 prompt. A4. Read the new section "Non-interactive shells and PS1" in the Class Note on "Startup Files: .bash_profile and .bashrc" and make sure you add that one line to the start of your ".bashrc". Verify that nothing extra prints when you run the "ssh localhost true" line. Your instructor will mark the .bashrc and .bash_profile files in your account on the assignment due date. Leave them there on the CLS. Do not delete anything. Here are some optional but recommended sysadmin aliases for your .bashrc: alias l='less' alias mv='mv -i' alias cp='cp -i -p' alias ls='ls -abp --color=auto' alias grep='grep --color=auto' I *don't* recommend aliasing "rm" to "rm -i", since it requires you to confirm every removal and quickly loses any protective value. Read the man pages for each command to know what the options to each command mean. The "cp -p" option is very useful for sysadmin. Your .bashrc is not re-read after you edit it - you have to tell bash to read it to make the new aliases appear: $ source ./.bashrc Part B - the cracker files -------------------------- See the Class Notes Lab Worksheet 5 for help in completing this assignment. The "story" here is that a cracker has hidden a bunch of WAREZ files in a directory on the server. (See https://en.wikipedia.org/wiki/Warez) Your job is to take a copy of these files, and only these files, for use in a court case. You must not copy any other files, only the WAREZ files. B1. Make a directory "assignment05/warez" in your CLS HOME directory. B2. Hidden under the directory ~idallen/cst8207/12f/assignment05/dirs is one single directory containing about 146,300 files. (Be careful about typing "ls" in this directory without using any output pagination pipe - the amount of output may flood your terminal window for some time.) 100 of these files in that one directory have names that contain your userid followed somewhere later by the string "warez", where "warez" may appear in any combination of upper- and lower-case letters, e.g. "warez","Warez","wArez","waREz", etc. A sample file name for userid abcd0001 might look like this (note that "warez" follows the userid): HhUtfgYtyGhjJADGekCAkgtZEKsTGKdYZZabcd0001ADGekCwaREZZaFSrXJnxGex Using one single command, copy all 100 of these cracker files (and no others) into your own directory named "warez" that you created above. Hint: Use a shell GLOB pattern to match the right file names. Hint: Do not use a pipe or "find" to do this. The shell can do it all. B3. Run "find assignment05 -ls" to show your results and redirect the output into your own file "assignment05/assignment05.txt". B4. Read the Class Note on "File transfer to/from Unix/Linux machines". Windows Users: Omit the sections on the PuTTY suite and SFTP but pay careful attention to the sections on line ends and the use of WinSCP. Mac and Linux Users: Use the "scp" command at a Terminal window. Transfer the assignment05.txt file from the CLS to your local computer and verify its contents. (It should contain the 100 warez file names for your userid.) B5. Submit the assignment05.txt file with the exact name before the due date. Your instructor will mark the assignment05 directory in your account on the due date. Leave them there on the CLS. Do not delete anything. 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/