% CST8207 Week 08 Notes - Hard Links, Symbolic Links, Disk Usage, Permissions % Ian! D. Allen - idallen@idallen.ca - www.idallen.com % Winter 2013 - January to April 2013 - Updated Wed May 8 21:01:24 EDT 2013 Readings, Assignments, Labs, and ToDo ===================================== - Fill in your [Course Evaluation Survey] for this course. Only nine questions! Closes March 17. - Read (at least) these things (All The Words): - [Week 08 Notes HTML] - this file - ** Read All The Words ** - [Unix/Linux File System - directories, inodes, etc. (correct explanation)] - [Hard links and Unix/Linux file system index nodes (inodes)] - [Symbolic Links - Soft Links - Symlinks] - [Unix/Linux Disk Usage, Hard Links, Finding Inodes] - [Unix Modes and Permissions] - [List of Commands] - From “Unix for Mac OS X Users” at [lynda.com] - more to come - Read (All The Words), Do, and save (not for hand in) - [Lab Worksheet #05 HTML] - optional BONUS VIM worksheet and assignment: [Lab Worksheet #06 ODT] [Lab Worksheet #06 PDF] [Lab Worksheet #06 HTML] - Read (All The Words), Do, and then Submit via Blackboard: - [Assignment #05 HTML] - GLOB, aliases, options, and start-up files - optional BONUS VIM assignment: [Assignment #06 HTML] (optional) - [Assignment #07 HTML] - hard links, disk usage, du - Write down the dates of your Final Exams from the [Course Home Page]. Midterm Test #2 - Week 10 - Thursday March 21 - 25% ==================================================== - Midterm test dates are posted on the [Course Home Page]. - Midterm Test #2 (Thu Mar 21) covers: - anything from the previous midterm test, especially questions that were not answered correctly, plus: - [Week 04 Notes HTML] - [Week 05 Notes HTML] - [Week 06 Notes HTML] - [Week 07 Notes HTML] - [Week 08 Notes HTML] - [Week 09 Notes HTML] - [Assignment #05] - [Assignment #07] - [Assignment #08] - [Lab Worksheet #05 ODT] - [Lab Worksheet #07 ODT] - Install Virtual Machine - [Lab Worksheet #08 ODT] - See the [Practice Test #2 PDF] and answer file in the [Class Notes]. The same questions are posted under **Practice** on Blackboard. - For full marks, you must read the [Test Instructions] before the test for important directions on how to enter your answers, your lab section number, and the test version number 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. From the Class Notes link on the Course Home Page ================================================= - Review last week. Did you do everything assigned last week? From the Classroom Whiteboard/Chalkboard ======================================== - Your in-class notes go here. - Fill in your [Course Evaluation Survey] for this course. Only nine questions! Closes March 17. - Tue Mar 5: Expected 90 responses, received 20 `22%` - Read [Last Term’s Course Evaluations] - [The lesson you never got taught in school: How to learn!] - create practice tests yourself - distribute your learning (cramming doesn’t work) Learning the Material ===================== > I was watching a student on the #95 bus running through her hand-made > flashcards to help memorize anatomy. Every card had a photocopied and > pasted picture of some muscle groups on the front with identifying letters, > and on the back-side were long, hand-written notes about what each lettered > group was. Those cards must have taken her hours to make, and rather than > play video games on her phone she was reviewing them on the ride home. Some > students are truly determined to succeed. *Have you made Linux flash cards > to memorize Linux commands and options?* Do you want to know Linux? Are you in the right field?  ![Genius Fish] Some Commands ============= Keep a notebook with a [List of Commands] in it. Why doesn’t this work? (See [Worksheet #05][Lab Worksheet #05 HTML] section 5.3.) $ touch lab5.3b $ rm lab5.[3b] Changes by Ubuntu to the basic Unix security model for symlinks and hard links: - Overview: - *“In the standard kernel, this […] blocks hardlinks to devices, setuid files, executable setgid files, and files that the UID making the link cannot read or write to (except that the owner of a file is always allowed to make hardlinks to it). Note that this blocks hardlinks to other people’s world-readable files if you can’t write to them.”* - - *“But some kernel hackers are not convinced that the core kernel should be fixing badly written applications.”* - - *“Both the Ubuntu Yama LSM and the new standard kernel code for this stuff include a second restriction, this time on what can be hardlinked.”* - Code patch and descriptions: - *“Normally, hardlinks can be created to files that a given user does not have access to. This can create security problems where privileged processes act on files that only they have access to, but have been put places unexpectedly by an attacker. This option limits the creation of hardlinks to files that a given user would be unable to read and write originally, or are not otherwise sensitive.”* - Change behaviour: `sysctl -w kernel.yama.protected_sticky_symlinks=0` - Change behaviour: `sysctl -w kernel.yama.protected_nonaccess_hardlinks=0` A useful option to `ls -l` is `-L` - dereference (follow, expand) symlinks and show the real thing: $ ls -dils /bin/*sh 524294 936 -rwxr-xr-x 1 root root 955024 Apr 3 2012 /bin/bash 524318 108 -rwxr-xr-x 1 root root 109768 Mar 29 2012 /bin/dash 524419 0 lrwxrwxrwx 1 root root 4 Sep 7 00:22 /bin/rbash -> bash 524434 0 lrwxrwxrwx 1 root root 4 Sep 7 00:22 /bin/sh -> dash 524438 0 lrwxrwxrwx 1 root root 7 Sep 7 00:22 /bin/static-sh -> busybox $ ls -dilsL /bin/*sh 524294 936 -rwxr-xr-x 1 root root 955024 Apr 3 2012 /bin/bash 524318 108 -rwxr-xr-x 1 root root 109768 Mar 29 2012 /bin/dash 524294 936 -rwxr-xr-x 1 root root 955024 Apr 3 2012 /bin/rbash 524318 108 -rwxr-xr-x 1 root root 109768 Mar 29 2012 /bin/sh 524297 1788 -rwxr-xr-x 1 root root 1827920 Apr 13 2012 /bin/static-sh $ ls -dilsL /bin/*sh | sort 524294 936 -rwxr-xr-x 1 root root 955024 Apr 3 2012 /bin/bash 524294 936 -rwxr-xr-x 1 root root 955024 Apr 3 2012 /bin/rbash 524297 1788 -rwxr-xr-x 1 root root 1827920 Apr 13 2012 /bin/static-sh 524318 108 -rwxr-xr-x 1 root root 109768 Mar 29 2012 /bin/dash 524318 108 -rwxr-xr-x 1 root root 109768 Mar 29 2012 /bin/sh - A useful option to `find` is `-ls` – display full pathname information similar to `ls -lids`: - `$ find . -size +0 -ls` - A useful option to `find` is `-links` – find by number of links: - `$ find /lib -type f -links +1 -ls` - A useful option to `find` is `-inum` – find by inode number: - `$ find /lib -inum 171600 -ls` Real Sysadmin Work ================== Learn how to write code: -- | 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 [Course Evaluation Survey]: https://coursefeedback.algonquincollege.com/etw/ets/et.asp?nxappid=WCQ&nxmid=start [Unix/Linux File System - directories, inodes, etc. (correct explanation)]: 450_file_system.html [Hard links and Unix/Linux file system index nodes (inodes)]: 455_links_and_inodes.html [Symbolic Links - Soft Links - Symlinks]: 460_symbolic_links.html [Unix/Linux Disk Usage, Hard Links, Finding Inodes]: 457_disk_usage.html [Unix Modes and Permissions]: 500_permissions.html [List of Commands]: 900_unix_command_list.html [lynda.com]: https://lyceum.algonquincollege.com/Lynda [Lab Worksheet #05 HTML]: worksheet05.html [Lab Worksheet #06 ODT]: worksheet06.odt [Lab Worksheet #06 PDF]: worksheet06.pdf [Lab Worksheet #06 HTML]: worksheet06.html [Lab Worksheet #05 ODT]: worksheet05.odt [Lab Worksheet #07 ODT]: worksheet07.odt [Lab Worksheet #08 ODT]: worksheet08.odt [Practice Test #2 PDF]: practicetest2.pdf [Class Notes]: indexcgi.cgi [Test Instructions]: 000_test_instructions.html [Last Term’s Course Evaluations]: ../../12f/course_evaluation.html [The lesson you never got taught in school: How to learn!]: http://bigthink.com/neurobonkers/assessing-the-evidence-for-the-one-thing-you-never-get-taught-in-school-how-to-learn [Genius Fish]: common/genius_fish.jpg "Genius Fish" [Plain Text]: week08notes.txt [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/