Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jeremy Ruston, Copyright © 2007-2011 UnaMesa Association
*http://www.simongrant.org/web/eco.html MAC vs DOS by Umberto Eco
*https://www.oreilly.com/ideas/how-we-got-linux-on-windows
*https://insights.ubuntu.com/2016/04/07/ubuntu-is-everywhere/
*https://cote.io/2016/09/18/red-hat-profile-67-linux-market-share/
*secure messaging
**https://ssd.eff.org/
**(out of date but interesting) https://www.eff.org/node/82654
**https://theintercept.com/2016/06/22/battle-of-the-secure-messaging-apps-how-signal-beats-whatsapp/
**https://www.relativisticramblings.com/ramblings/telegram-vs-signal/
*http://portal.on24.com/view/channel/index.html?showId=1101876&showCode=linux&contentId=1125288
*https://drownattack.com/
http://arstechnica.com/information-technology/2015/05/01/boeing-787-dreamliners-contain-a-potentially-catastrophic-software-bug/
*https://arstechnica.com/business/2017/05/facebook-helped-advertisers-target-teens-who-feel-worthless/
*https://t.co/AaiPp8NQm0 Linux Kernel "Code of Conflict"
*http://www.emojicode.org/
*http://www.theguardian.com/commentisfree/2016/apr/10/whatsapp-encryption-billion-users-data-security
*https://telegram.org/faq#q-so-how-do-you-encrypt-data (was always encrypted)
*https://www.eff.org/secure-messaging-scorecard
*http://www.cbc.ca/news/technology/freedom251-1.3453103 Thanks to Kajal
*https://www.raspberrypi.org/blog/raspberry-pi-zero/ Thanks to Kagal & Seb
*http://www.gizmodo.com.au/2016/03/seven-years-set-aside-for-nothing-but-bug-fixing-in-the-joint-strike-fighter/
*http://www.popularmechanics.com/technology/infrastructure/news/a26456/microsoft-machine-learning-vision/
*https://dev.to/ben/my-all-time-favorite-demonstration-of-a-cross-site-scripting-attack cross site scripting attack
*https://x3mspot.wordpress.com/2017/05/10/the-final-user/ The Linux End User
*India rejects "Free" facebook internet
**http://arstechnica.com/tech-policy/2016/02/facebooks-free-internet-app-banned-by-indias-new-net-neutrality-rule/
**http://www.thedailybeast.com/articles/2016/02/09/india-rejects-facebook-s-free-internet.html
**http://www.nytimes.com/2016/02/11/technology/facebook-rejects-marc-andreessen-comments-on-india-and-he-apologizes.html
*http://www.lesaffaires.com/blogues/julien-brault/pourquoi-les-quebecois-ont-tout-avantage-a-etudier-cette-matiere-boudee/585242 Big Data (Data Analysis) the future of "programming"
*https://act.eff.org/action/save-alice-tell-the-patent-office-to-apply-supreme-court-law
*https://www.computerweekly.com/news/252458632/Teen-becomes-first-millionaire-through-HackerOne-bug-bounties
*https://www.computerweekly.com/news/252458208/Facebook-planned-to-spy-on-Android-phone-users-internal-emails-reveal
* https://en.wikipedia.org/wiki/History_of_the_World_Wide_Web 30 years old today
* Berners Lee & Cailliau
** https://thenextweb.com/eu/2010/04/28/robert-cailliau/
** https://en.wikipedia.org/wiki/Robert_Cailliau
*https://youtu.be/qYfNzhLXYGc VR
*pingfs https://github.com/yarrcick/pingfs really???
*https://www.eff.org/deeplinks/2016/04/nest-reminds-customers-ownership-isnt-what-it-used-be
br
*https://jann.is/lego-macintosh-classic/ Made with Raspberry PI & Docker
*https://mastodon.social/about alternative to twitter
*<nowiki>#!</nowiki> was discontinued! From Paul
**http://crunchbang.org/forums/viewtopic.php?pid=416493#p416493
**http://distrowatch.com/table.php?distribution=crunchbang
*http://www.zdnet.fr/actualites/la-probabilite-d-etre-infecte-sur-telephone-mobile-068-39814656.htm#xtor=RSS-1
*http://www.thedailybeast.com/articles/2017/05/12/stolen-nsa-tech-shuts-down-hospitals
@@From Kajal Bordhon (420-241-DW sect.00001 (W2016)) @@
Date Tue Apr-12-2016 at 19:01 - 2 days ago
Subject RASPBERRY PI and other stuff
RASPBERRY PI ZERO: THE $5 COMPUTER
https://www.raspberrypi.org/blog/raspberry-pi-zero/
Apple vs the Goverment start again:
http://www.kitguru.net/apple/matthew-wilson/us-department-of-justice-still-wants-apples-help-unlocking-iphones/
5$ smart phone
http://www.smh.com.au/digital-life/mobiles/worlds-cheapest-smartphone-costs-5-and-doesnt-seem-terrible-at-all-20160218-gmy2f2.html
review: https://www.youtube.com/watch?v=utRww8-QuBw
Apple patents a Macbook with no keyboard:
http://www.technobuffalo.com/2016/04/07/apple-invents-a-crazy-new-force-touch-macbook-without-a-keyboard/
Rumor: Google is planning to replace java with swift
http://www.androidauthority.com/google-swift-java-685209/
ransomware vulnerability in window 10:
http://www.pcworld.com/article/3053090/security/adobe-fixes-24-vulnerabilities-in-flash-player-including-an-actively-exploited-one.html
Firefox exploit:
http://arstechnica.com/security/2016/04/noscript-and-other-popular-firefox-add-ons-open-millions-to-new-attack/
This one is just weird:
http://www.digitaltrends.com/web/anti-piracy-group-rightscorp-wants-to-hijack-browsers/#ixzz44sizqbh3
*February 12, 1809\
**Find your species https://www.wolframcloud.com/objects/user-55ede016-e048-4097-9b58-db218e02e037/DarwinDay
*Find your birth date in the digits of PI http://www.mypiday.com/
http://i.imgur.com/d9cU904.png
*Now that you know about http, https = http +TLS/SSL = http+encryption, to to provide encryption it needs a certificate:
**http://www.eweek.com/security/lets-encrypt-internet-security-initiative-exits-beta.html free certs for all
*http://www.wired.com/2016/04/facebook-seized-media-thats-bad-news-everyone-facebook/
*http://www.cjr.org/innovations/investigating_algorithms.php
*https://www.wired.com/2017/04/security-news-week-microsoft-word-zero-day-left-folks-scrambling/
*http://www.ctvnews.ca/business/43m-in-cash-found-in-empty-nigerian-apartment-1.3368884 He's been trying to share for years
*https://www.linux.com/what-is-linux
*http://www.bbc.com/future/story/20150209-the-network-that-runs-the-world
*http://programmingexcuses.com/
*http://www.theonion.com/articles/features-of-the-apple-car,38023/
*Bad tech security can be life threatening http://www.zdnet.com/article/hollywood-hospital-becomes-ransomware-victim/
*https://hbr.org/2016/02/the-reason-twitters-losing-active-users
**http://www.theguardian.com/film/2016/feb/15/stephen-fry-deletes-twitter-account-after-baftas-bag-lady-offence
*http://xkcd.com/1638/
*http://www.telegraph.co.uk/technology/2016/02/15/stephen-frys-new-startup-is-a-pinterest-for-education/
*http://www.bbc.com/news/business-35250678 Sophisticated phishing on businesses ...
*http://www.ted.com/talks/eli_pariser_beware_online_filter_bubbles?language=en
*https://www.youtube.com/watch?v=FfaVwkRdwuk Cory Doctrow, OSCON FLOSS is everywhere
*https://en.wikipedia.org/wiki/Front_and_back_ends#Back-end_focused
*https://www.youtube.com/watch?v=zsjZ2r9Ygzw
*http://venturebeat.com/2016/03/13/facebook-arrest-foreshadows-the-global-data-encryption-war/
*http://www.atlasobscura.com/articles/why-only-apple-users-can-trash-their-files
*easter egg
**load http://www.vogue.co.uk/
**up, up, down, down, left, right, left, right, b, a
***hat changes every time
Trevor let me know this key sequence is the https://en.wikipedia.org/wiki/Konami_Code
*http://www.theregister.co.uk/2017/02/15/think_different_shut_up_and_work_harder_says_linus_torvalds/
*https://medium.freecodecamp.com/ill-never-bring-my-phone-on-an-international-flight-again-neither-should-you-e9289cde0e5f#.80qjhp4o9
**"What’s the worst thing that could happen... Well…"
*linux https://tech.slashdot.org/story/19/01/05/1928205/linux-for-cars-tesla-isnt-the-only-automaker-running-linux-under-the-hood
*FOSS http://www.linux-magazine.com/Online/News/Microsoft-Gets-an-Open-Source-Web-Browser
*patents https://arstechnica.com/tech-policy/2019/01/apple-loses-patent-case-appeal-owes-virnetx-440m-in-facetime-dispute/
*privacy https://arstechnica.com/gadgets/2019/01/google-play-starts-manually-whitelisting-sms-and-phone-apps/
*https://www.futureme.org/
*http://xkcd.org/1513/ Self taught
*More serious CryptoWall
* University of Ottaws comm:
**http://www.techrepublic.com/article/cryptowall-what-it-is-and-how-to-protect-your-systems/
**http://www.publicsafety.gc.ca/cnt/rsrcs/cybr-ctr/2013/in13-004-eng.aspx
{{{
In the last two weeks, the University of Ottawa has been targeted by a
ransomware computer virus known as CryptoWall.
Ransomware is software which scans a computer and encrypts all the
data files it can find, including files in shared network folders.
Unless backups exist, the data is unrecoverable unless payment is made to the virus author.
}}}
*http://www.linuxfoundation.org/news-media/announcements/2015/03/2015-linux-jobs-report-linux-professionals-high-demand
Key statistics include:
97 percent of hiring managers reported that they will prioritize hiring Linux talent relative to other skills areas in the next six months.
42 percent of hiring managers say that OpenStack and CloudStack experience will have a major impact on their hiring decisions this year.
23 percent report that security is a sought-after area of expertise and 19 percent will look for Linux talent with Software-Defined Networking (SDN) skills.
44 percent of hiring managers saying they’re more likely to hire a candidate with Linux certification.
54 percent expect either certification or formal training of all SysAdmin candidates.
*http://www.microsoft.com/Investor/EarningsAndFinancials/Financials/FY15/Q2/SegmentRevenues.aspx
*How many people use Ubuntu
** video https://www.youtube.com/watch?v=_454cLqvmY8
** infographic https://insights.ubuntu.com/2016/04/07/ubuntu-is-everywhere/
* What Linus uses https://www.youtube.com/watch?v=qHGTs1NSB1s
* just plain cool https://media.giphy.com/media/xT1XGIrDjj68WEb5kI/giphy.gif
*http://mic.com/articles/135549/apple-vs-fbi-no-one-wins
**http://motherboard.vice.com/read/fbi-order-apple-san-bernardino-encryption-hacking-backdoor-technical-explainer?trk_source=popular
**http://www.nytimes.com/2016/02/18/technology/apple-timothy-cook-fbi-san-bernardino.html?_r=0
*https://openmedia.org/en/government-should-step-after-disappointing-crtc-ruling-closes-door-new-affordable-wireless
*http://motherboard.vice.com/read/judge-rules-fbi-must-reveal-malware-used-to-hack-over-1000-computers-playpen-jay-michaud
*https://futurism.com/more-americans-work-in-solar-power-than-for-apple-facebook-and-google-combined/
*https://motherboard.vice.com/en_us/article/hackers-why-they-hit-stalkerware-flexispy-retina-x
*https://thenextweb.com/insider/2017/04/19/your-expensive-noise-cancelling-headphones-are-probably-spying-on-you/
*https://arstechnica.com/security/2017/04/vigilante-botnet-infects-iot-devices-before-blackhats-can-hijack-them/
*https://www.youtube.com/watch?v=SOXeXauRAm0 Tour of Linus' home office
*http://betanews.com/2015/02/01/robots-are-after-my-job-and-perhaps-yours-too/
*http://www.ted.com/talks/kevin_slavin_how_algorithms_shape_our_world?language=en
*https://www.battleforthenet.com/countdown/
*https://www.technologyreview.com/s/545631/how-paypal-boosts-security-with-artificial-intelligence/
*http://programmingexcuses.com/
*Why bash scripting is useful: https://www.jitbit.com/alexblog/249-now-thats-what-i-call-a-hacker/
*http://torrentfreak.com/the-worlds-most-idiotic-copyright-complaint-150222/
*http://youtu.be/CDsNZJTWw0w Biomechanics! From **http://openprosthetics.org/about/17/cad-software
*https://www.computerweekly.com/news/252458632/Teen-becomes-first-millionaire-through-HackerOne-bug-bounties
*https://www.computerweekly.com/news/252458208/Facebook-planned-to-spy-on-Android-phone-users-internal-emails-reveal
All are thanks to Kajal!
China bans Apple’s iBooks and movies:
http://arstechnica.com/apple/2016/04/nyt-china-bans-apples-ibooks-and-itunes-movies-stores/
Google Play Store in Chrome OS:
http://arstechnica.com/gadgets/2016/04/it-looks-like-the-google-play-store-is-headed-to-chrome-os/
Log in with your skull?:
http://www.engadget.com/2016/04/22/skull-login-bone-conduction-biometrics/
Youtube and more ads:
http://www.engadget.com/2016/04/26/youtube-six-second-bumper-ads/
Microsoft DNA storage:
http://arstechnica.com/information-technology/2016/04/microsoft-experiments-with-dna-storage-1000000000-tb-in-a-gram/
Comcast and DreamWorks:
http://arstechnica.com/the-multiverse/2016/04/comcast-looking-to-buy-dreamworks-for-more-than-3-billion-reports-say/
The end of Cortana as we know it :(
http://arstechnica.com/information-technology/2016/04/cortana-web-searches-in-windows-10-will-now-only-be-able-to-open-edge-and-bing/
Yay high resolution selfie on social media (sarcasm) :
http://www.gsmarena.com/two_new_sony_phones_leak_through_benchmark_one_has_a_16mp_selfie_cam-news-18026.php
Hackers stole $80 million from a central bank and it had to be in my home countrie -_- :
http://uk.businessinsider.com/r-bangladesh-bank-exposed-to-hackers-by-cheap-switches-no-firewall-police-2016-4?utm_content=buffer04ba7&utm_medium=social&utm_source=facebook.com&utm_campaign=buffer?r=US&IR=T
German nuclear plant’s filled with malwares:
http://arstechnica.com/security/2016/04/german-nuclear-plants-fuel-rod-system-swarming-with-old-malware/
Google Patents Smart Lenses:
http://www.engadget.com/2016/04/29/google-patent-injectable-smart-lenses/
Apple annonce the worst quarter since 2003 (it will get worse with their new Iphone SE):
http://money.cnn.com/2016/04/25/technology/apple-earnings/index.html?iid=hp-toplead-dom
Intel join Apple to replace headphone jack with usb-c :
http://www.anandtech.com/show/10273/intel-proposes-to-use-usb-typec-cables-to-connect-headsets-to-mobile-devices
Vancouver Scores Low on Internet Performance:
http://globalnews.ca/news/2668523/vancouver-scores-low-on-internet-performance-study/
Tommorow is mosly sunny with a few drop of windows popup:
https://www.rt.com/viral/341275-windows-10-popup-weather-forecast/
Us vs ISIS virtual warfare:
http://arstechnica.com/security/2016/04/us-military-plans-to-drop-cyberbombs-on-isis-nyt-says/
*http://www.forbes.com/sites/susanadams/2015/04/15/the-college-degrees-and-skills-employers-most-want-in-2015/
*http://www.wired.com/2015/04/antitrust-debacle-googles-real-victim/
*Game of codes https://youtu.be/3vI_7os2V_o
*Algorithms http://xkcd.org/1667/
*https://cdn.ampproject.org/c/www.theverge.com/platform/amp/2016/4/20/11466368/skysafe-drones-detect-disable-protection hijacking drones for safety
*https://www.cbc.ca/news/technology/google-nest-mic-forgot-1.5027333
*https://www.eff.org/deeplinks/2019/02/french-data-protection-authority-takes-google
*https://medium.com/backchannel/the-next-social-media-we-want-and-need-2d03a7e0551c#.dmpdzfgy3
*http://www.cbc.ca/news/technology/prime-number-discovery-1.3411711 Thanks to Jaya
*http://arstechnica.com/information-technology/2013/01/internet-explorer-ends-the-year-on-a-high-windows-8-slow-to-get-noticed/
**http://imgur.com/gallery/tsAHque
**http://xkcd.com/111/
*http://www.h-online.com/open/news/item/Puppet-Labs-gets-30M-investment-from-VMware-1790178.html
*http://arstechnica.com/gadgets/2013/01/why-mark-shuttleworth-thinks-ubuntu-on-phones-will-outclass-android/
*Raspberry PI
**http://www.southampton.ac.uk/mediacentre/features/raspberry_pi_supercomputer.shtml (from Danijel Livaja section 1)
**http://www.raspberrypi.org/quick-start-guide
***ARM based computer running under GNU/Linux
***http://www.raspberrypi.org/faqs
*http://news.cnet.com/8301-1001_3-57565196-92/intel-to-wind-down-desktop-circuit-board-business/
* Blackberry 10 & RIM rename http://www.theglobeandmail.com/globe-investor/blackberry-10-launch-just-first-move-in-companys-comeback-plan/article7998340/
*Alan Cox resigns
**http://www.livemint.com/Companies/R3ejpyW3GZBmyVWUbg3thO/Alan-Cox-No-2-in-Linux-world-resigns.html
**http://www.techweekeurope.co.uk/news/alan-cox-leaves-intel-linux-105279
*http://arstechnica.com/tech-policy/2013/01/how-newegg-crushed-the-shopping-cart-patent-and-saved-online-retail/
*http://www.itwire.com/opinion-and-analysis/open-sauce/58456-debian-gurus-plea-for-sane-computing-future
*http://news.cnet.com/8301-10805_3-57566135-75/acer-windows-8-still-not-successful/
*http://news.cnet.com/8301-10805_3-57566340-75/office-boss-within-10-years-every-customer-will-subscribe
*http://www.washingtonpost.com/business/technology/tech-telecom-giants-take-sides-as-fcc-proposes-large-public-wifi-networks/2013/02/03/eb27d3e0-698b-11e2-ada3-d86a4806d5ee_story.html
*http://www.h-online.com/open/news/item/City-of-Munich-disagrees-with-HP-s-Linux-migration-study-1797232.html
*ewe http://arstechnica.com/information-technology/2013/02/windows-apps-coming-to-android-with-wine-port/
*http://www.networkworld.com/news/2013/020513-microsoft-may-be-seeking-protection-266437.html
*http://www.zdnet.com/top-linux-and-open-source-programs-survey-results-7000010858/
*http://arstechnica.com/information-technology/2013/02/robohand-how-cheap-3d-printers-built-a-replacement-hand-for-a-five-year-old-boy/
** they've //"open sourced"// the design http://comingupshorthanded.com/open-source-design-info/
*http://news.cnet.com/8301-1001_3-57567844-92/amateur-effort-finds-new-largest-prime-number/?part=rss&subj=news&tag=2547-1_3-0-20
*http://www.wired.com/gadgetlab/2013/02/why-vines-going-to-grow-into-something-really-huge/
*http://news.cnet.com/8301-10805_3-57569125-75/surface-pro-knocked-for-low-repairability-by-ifixit
*YAY! http://www.reuters.com/article/2013/02/15/us-obama-patent-idUSBRE91E03320130215
*http://opensource.com/government/13/2/us-department-state-unveils-open-book-project
*http://arstechnica.com/information-technology/2013/02/why-microsofts-new-office-2013-license-may-send-users-to-google-docs/
*http://fossforce.com/2013/02/microsoft-cranks-up-fud-machine/
*http://www.wired.com/gamelife/2013/02/steam-linux/ (Thanks to Nader)
*http://www.geeky-gadgets.com/ubuntu-tablet-os-announcement-later-today-by-canonical-19-02-2013/ (Thanks to Peter)
*http://venturebeat.com/2013/02/20/wheres-tux-when-you-need-him/ (or her)
*http://www.h-online.com/open/news/item/Secure-Boot-restrictions-can-be-disabled-in-Fedora-1805403.html
*http://www.theregister.co.uk/2013/02/18/open_and_shut/
*http://blog.experts-exchange.com/ee-tech-news/report-open-source-software-on-par-with-proprietary-code-software/
*http://opensource.com/life/13/1/inkscape-save-from-crime
*https://www.linux.com/news/software/multimedia/690516-software-wars-the-movie-a-message-to-the-masses-
*http://www.shamusyoung.com/twentysidedtale/?p=18309 tongue in cheek comparison
*http://arstechnica.com/information-technology/2013/02/linus-torvalds-i-will-not-change-linux-to-deep-throat-microsoft/
**http://www.muktware.com/5276/linus-torvalds-secure-boot-supporters-not-dick-sucking-contest (rude language)
**http://www.zdnet.com/torvalds-clarifies-linuxs-windows-8-secure-boot-position-7000011918/
**define UEFI & the fight over it w Micr$oft http://arstechnica.com/information-technology/2012/01/windows-8s-locked-bootloaders-much-ado-about-nothing-or-the-end-of-the-world-as-we-know-it/
*http://linux.slashdot.org/story/13/02/26/205210/how-the-open-invention-network-protects-linux-and-open-source-video
*http://youtu.be/nKIu9yen5nc What most schools don't teach (thanks to Akash)
*https://www.acquia.com/resources/acquia-tv/conference/how-new-yorks-mta-uses-drupal-caching-get-riders-there-time
*http://xkcd.com/1179/ ISO 8601 (date +%F)
*http://news.cnet.com/8301-1001_3-57571413-92/hps-whitman-were-shifting-resources-from-pcs-to-tablets
*http://www.wired.com/wiredenterprise/2013/02/restorations-2
*http://opensource.com/business/13/2/2013-linux-jobs-survey-report Thanks to Maja
*http://www.openculture.com/2013/03/creative_commons_announces_school_of_open_with_courses_to_focus_on_digital_openness.html Thanks to Maja
*http://linuxgizmos.com/google-self-driving-car-from-software-perspective-video/
* An example of how hardware and software are becoming more open (their own app is clunky but they've released the api & sdk for wider use)
**http://arstechnica.com/gadgets/2013/03/philips-delivers-promised-dev-docs-for-colorful-hue-led-lights/
*http://news.yahoo.com/xi3-piston-first-steam-box-console-preorder-100-173200120.html
*http://news.cnet.com/8301-10805_3-57573979-75/hotmail-outlook-skydrive-hit-by-service-disruptions
*http://opensource.com/education/13/2/open-source-economic-model
*http://www.theregister.co.uk/2013/03/15/samsung_windows_not_selling/
*http://www.thevarguy.com/2013/03/18/netflix-invites-open-source-cloud-app-development/
*http://news.slashdot.org/story/13/03/18/0316221/the-pirate-bays-oldest-torrent-is-revolution-os Thanks to Nader
*http://www.wired.com/gamelife/2013/03/gamelife-video-9
*http://lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily (versus terminator)
*http://news.cnet.com/8301-10805_3-57575732-75/microsoft-defends-windows-rt-as-necessary-disruption
*http://arstechnica.com/information-technology/2013/03/open-source-web-based-office-suite-takes-on-google-docs-libreoffice/
*http://www.h-online.com/security/news/item/Botnet-uses-hacked-devices-to-scan-the-internet-1825753.html
*http://arstechnica.com/information-technology/2013/03/goodbye-windows-china-to-create-home-grown-os-based-on-ubuntu/
*http://www.abundancethebook.com/
*http://www.cgtantra.com/forums/showthread.php?t=33952
**Alias Wavefront developed Maya in Toronto (Maya is not FLOSS but uses OpenGL which is FLOSS)
**Autodesk Softimage (formerly XSI) developed in Montréal (may use OpenGL ??? runs on Linux)
**https://developer.valvesoftware.com/wiki/Blender FLOSS (not necessarily FLOSS https://developer.valvesoftware.com/wiki/3D_Modeling_Programs)
*http://www.defectivebydesign.org/we-dont-want-the-hollyweb
*http://hardware.slashdot.org/story/13/03/26/2226246/spanish-open-source-group-files-complaint-over-microsoft-use-of-uefi-secure-boot
**http://news.yahoo.com/exclusive-open-software-group-files-complaint-eu-against-110311005--finance.html
*Google trivia: paste this in sqrt(cos(x))*cos(300x)+sqrt(abs(x))-0.7)*(4-x*x)^0.01, sqrt(6-x^2), -sqrt(6-x^2) from -4.5 to 4.5
*http://news.cnet.com/8301-10805_3-57576483-75/microsoft-lands-design-patents-for-surface-cover-keyboard/
*http://arstechnica.com/tech-policy/2013/03/you-cant-patent-simple-math-judge-tells-patent-troll-uniloc/
*http://uni.xkcd.com
*http://www.steamforlinux.com/?q=en/node/204
*http://www.wired.com/wiredenterprise/2013/04/cell-phone-ads/
*http://www.wired.com/wiredenterprise/2013/04/felten freedom to tinker (openness)
*http://opensource.com/law/13/4/improving-patent-procedures
*http://www.theregister.co.uk/2013/04/05/facebook_home_copies_windows_phone/
*http://www.theregister.co.uk/2013/04/05/google_vs_patent_privateers/
*http://openbook.okfn.org/timeline/
*Google trivia: 1.5sqrt(-abs(abs(x)-1)*abs(3-abs(x))/((abs(x)-1)*(3-abs(x))))(1+abs(abs(x)-3)/(abs(x)-3))sqrt(1-(x/7)^2)+(4.5+0.75(abs(x-.5)+abs(x+.5))-2.75(abs(x-.75)+abs(x+.75)))(1+abs(1-abs(x))/(1-abs(x))),-3sqrt(1-(x/7)^2)sqrt(abs(abs(x)-4)/(abs(x)-4)),abs(x/2)-0.0913722(x^2)-3+sqrt(1-(abs(abs(x)-2)-1)^2),(2.71052+(1.5-.5abs(x))-1.35526sqrt(4-(abs(x)-1)^2))sqrt(abs(abs(x)-1)/(abs(x)-1))
@@Now is the time to start reviewing for the final exam.
All of the material is on moodle, along with the associated chapters in your book.
If you do not understand something, ask me about it.@@
*http://www.informationweek.in/open_source/13-04-10/bse_slashes_operational_costs_by_adopting_linux.aspx
*http://linuxgizmos.com/5-millionth-linux-powered-roku-player-ships/
*http://news.cnet.com/8301-13579_3-57579054-37/judge-chastises-apple-google-over-patent-litigation/
*http://www.numerama.com/magazine/25646-l-oeb-distingue-un-brevet-logiciel-pour-son-34prix-de-l-inventeur-201334.html
*Lab Schedule http://www.dawsoncollege.qc.ca/our-services/information-services-and-technology/computer-centre
*http://www.zdnet.com/parallella-the-99-linux-supercomputer-7000014036/ (thanks to Danijel)
*http://www.businessinsider.com/congress-passes-cispa-cybersecurity-bill-2013-4
**http://news.cnet.com/8301-13578_3-57580268-38/cispa-permits-police-to-do-warrantless-database-searches/
**http://www.rawstory.com/rs/2013/04/16/obama-threatens-to-veto-invasive-cybersecurity-bill-cipsa/
*http://arstechnica.com/information-technology/2013/04/power-of-arduino-and-raspberry-pi-combined-in-99-androidlinux-pc/
*http://www.businessinsider.com/mobile-market-share-2012-11
*http://news.cnet.com/8301-10805_3-57580358-75/microsoft-working-on-small-touch-devices-running-windows/
*http://news.cnet.com/8301-13579_3-57580209-37/apple-tries-to-patent-tech-behind-itunes-u/
*http://www.tripwire.com/state-of-security/it-security-data-protection/cyber-security/security-visualization-vlan-ddos-visualized-as-a-game-of-pong thanks to Marc
**https://code.google.com/p/logstalgia/
*http://www.bbc.co.uk/news/technology-22314938
*http://arstechnica.com/information-technology/2013/04/ubuntu-13-04-boosts-graphics-performance-to-prepare-for-phones-tablets/
*http://bits.debian.org/2013/04/release-date.html
**http://wiki.debian.org/ReleasePartyWheezy#ReleasePartyWheezy.2FCanada.2FMontreal.Canada:_Montreal
*http://www.wolframalpha.com/
*http://www.keo.org/uk/pages/introuk.html
*http://www.bbc.co.uk/news/technology-22308353 (Thanks to Matt Z)
*http://www.technologyreview.com/news/514066/what-happened-when-one-man-pinged-the-whole-internet/ (Thanks to Geethan)
*http://www.cbc.ca/news/technology/story/2013/04/26/technology-alexander-graham-bell-voice.html (Thanks to Shabeer)
*http://www.usatoday.com/story/money/business/2013/04/28/college-grads-job-interviews/2113505/ (Thanks to Alex)
*http://arstechnica.com/information-technology/2013/04/google-releases-glass-source-code-declares-platform-open-to-hackers/
*http://www.wired.com/opinion/2013/04/this-eula-was-inspired-by-every-app-store-social-network-search-engine-and-online-payment-service/
*https://joinup.ec.europa.eu/community/osor/news/spains-extremadura-starts-switch-40000-government-pcs-open-source
*http://www.theregister.co.uk/2013/05/01/linux_kernel_3_9/ (Thanks to Peter)
**http://www.h-online.com/open/features/What-s-new-in-Linux-3-9-1845705.html
*http://www.ocaholic.ch/modules/news/article.php?storyid=6767&lang=english (Thanks to Danijel)
*http://www.techdirt.com/articles/20130501/09000922908/when-startups-need-more-lawyers-than-employees.shtml
<<list filter "[tag[news2013]] [sort[-modified]] " >>
!! This Week [[2013 Week 15]] May 06
!!Previous News Weeks
[[2013 Week 02]] Jan 28
[[2013 Week 03]] Feb 4
[[2013 Week 04]] Feb 11
[[2013 Week 05]] Feb 18
[[2013 Week 06]] Feb 25
[[2013 Week 07]] Mar 4
MarchBreak Mar 11
[[2013 Week 08]] Mar 18
[[2013 Week 09]] Mar 25
[[2013 Week 10]] Apr 01
[[2013 Week 11]] Apr 08
[[2013 Week 12]] Apr 15
[[2013 Week 13]] Apr 22
[[2013 Week 14]] Apr 29
*http://opensource.com/government/14/1/italy-open-source-software-procurements
**http://fsfe.org/news/2014/news-20140116-01.en.html
**From 2013 http://www.techrepublic.com/article/how-munich-rejected-steve-ballmer-and-kicked-microsoft-out-of-the-city
*http://arstechnica.com/gadgets/2014/01/motorola-ceo-talks-50-smartphone-customizable-screen-sizes/
*http://techthrob.com/2010/06/12/5-things-new-linux-converts-should-know/
*http://www.theregister.co.uk/2014/01/22/amazon_open_source_investigation/
US Patent news
*bad
**http://www.theregister.co.uk/2014/01/22/simpleair_wins_patent_suit_against_google/
*good
**http://news.yahoo.com/u-supreme-court-refuses-hear-internet-shopping-patent-171250777--sector.html
**http://arstechnica.com/tech-policy/2014/01/supreme-court-looks-to-rein-in-top-patent-court-with-two-new-cases/
*http://www.maketecheasier.com/microsoft-scared-chromebooks/
*http://www.i-programmer.info/news/149/6879.html {{{ Facebook's Bug Bounty program was initiated in 2011 and in its own words: provides recognition and compensation to security researchers practicing responsible disclosure.}}}
*http://www.maketecheasier.com/why-ip-addresses-wont-replace-phone-numbers
*http://arstechnica.com/gadgets/2014/02/linux-on-the-nuc-using-ubuntu-mint-fedora-and-the-steamos-beta/ next unit of computing
*http://www.itwire.com/features/browse/cloud-services/63012-open-systems-the-key-to-customer-service-in-banking
*http://www.theguardian.com/technology/2014/jan/29/uk-government-plans-switch-to-open-source-from-microsoft-office-suite
*http://www.theregister.co.uk/2013/12/16/munich_signs_off_on_open_source_project
*http://www.wired.com/autopia/2014/02/open-source-vehicle/
*http://www.theguardian.com/technology/2014/feb/11/nokia-phone-android-microsoft (thanks to Theo!)
*http://www.independent.co.uk/life-style/gadgets-and-tech/news/flappy-bird-taken-down-as-it-was-an-addiction-that-had-to-be-stopped-permanently-says-creator-dong-nguyen-9120689.html (thanks to Theo!)
DDOS
*http://www.digitalattackmap.com/#anim=1&color=0&country=ALL&time=16113&view=map
**http://www.tripwire.com/state-of-security/security-data-protection/security-visualization-vlan-ddos-visualized-as-a-game-of-pong/
*https://code.google.com/p/logstalgia/
*http://www.maketecheasier.com/receive-android-notification-on-linux-desktop
*http://www.pcworld.com/article/2104880/red-hat-enterprise-linux-now-on-amazons-govcloud.html
*http://arstechnica.com/security/2014/03/critical-crypto-bug-leaves-linux-hundreds-of-apps-open-to-eavesdropping/
**http://arstechnica.com/apple/2014/02/apple-releases-os-x-10-9-2-patches-ssl-flaw-and-adds-facetime-audio-support/
**http://www.extremetech.com/computing/177882-massive-linux-security-flaw-dwarfs-apples-cryptography-problems-of-just-last-week
**http://www.tomsguide.com/us/critical-linux-flaw-gnutls,news-18406.html
*http://www.pcworld.com/article/2103860/linux-group-could-hasten-64bit-android-for-arm-mobile-devices.html
*http://www.wolfram.com/raspberry-pi/ (thanks to Adam!)
**http://www.youtube.com/watch?v=_P9HqHVPeik
**http://www.raspberrypi.org/faqs
*http://www.zdnet.com/linux-mintbox-2-sells-out-in-european-debut-7000027624/
*http://www.android.com/wear/
**http://www.linuxinsider.com/story/Sony-Gives-Android-Wear-the-Cold-Shoulder-80196.html
*http://www.linuxinsider.com/story/An-Indecent-Proposal-Microsoft-and-Red-Hat-80185.html
*http://www.theregister.co.uk/2014/03/26/atm_sms_malware/
*http://www.theglobeandmail.com/technology/tech-news/kickstarter-backers-of-oculus-rift-angrily-reject-facebook-takeover/article17692680/
*http://gizmodo.com/hacked-twitter-accounts-can-be-more-valuable-than-stole-15530364534
*https://openmedia.ca/news/expert-report-reveals-internet-providers-should-be-more-transparent-about-how-they-handle-our-privat
**click on star table for this: https://dl.dropboxusercontent.com/u/8140293/ISP%20Transparency%20Report%20StarTable%202014Mar19.pdf
*Money is not the most important thing and the cost of education in the US is increasingly ridiculous and there are other factors involved but the most interesting point is that Stanford Economics grads earn $900K and CS grads $1600K over 20 years. Could reflect the pace of change over the last 20 years but still interesting. Note Bill Gates is richer than most and he did not finish his degree at Harvard, but he did complete 3 years of courses (per wikipedia)
**http://www.theatlantic.com/business/archive/2014/03/which-college-and-which-major-will-make-you-richest/359628/
*Discussed last week
**http://www.wired.com/2011/02/anonymous-hacks-hbgary/
**http://arstechnica.com/tech-policy/2011/02/anonymous-speaks-the-inside-story-of-the-hbgary-hack/
*http://xkcd.com/1349/ Shouldn't be hard
@@Now is the time to start reviewing for the final exam.
All of the material is on moodle, along with the associated chapters in your book.
If you do not understand something, ask me about it.@@
@@Tutorial sessions in the lab this week and next Wednesday Apr 16th & 23rd 4pm @@
*http://techcrunch.com/2014/04/07/massive-security-bug-in-openssl-could-effect-a-huge-chunk-of-the-internet/ from Adam
**http://xkcd.com/1354/
**http://www.theregister.co.uk/2014/04/09/heartbleed_explained/ code
**http://www.theregister.co.uk/2014/04/10/many_clientside_vulns_in_heartbleed_says_sans/
**http://www.dailymail.co.uk/sciencetech/article-2602277/Heartbleed-accident-Developer-confesses-coding-error-admits-effect-clearly-severe.html
**http://globalnews.ca/news/1269168/900-sin-numbers-stolen-due-to-heartbleed-bug-canada-revenue-agency/ from Chris D
*http://www.cnet.com/news/pure-lifi-transmits-data-using-light-video/ thanks to Theo
*http://enthusiast.hardocp.com/news/2014/04/24/fcc_backs_fast_lanes_for_web_traffic thanks to Julien
**http://www.cbc.ca/news/technology/new-net-neutrality-rules-coming-from-fcc-1.2620314
**https://openmedia.ca/blog/motherboard-canada-wont-escape-fccs-gutting-net-neutrality
**http://recode.net/2014/04/26/does-anyone-like-the-fccs-proposed-net-neutrality-rules/
**http://business.financialpost.com/2014/04/25/net-neutralitys-demise-in-u-s-and-canada-regulators-look-at-changing-rules
*http://www.cbc.ca/news/technology/internet-explorer-bug-used-by-hackers-to-attack-u-s-firms-1.2624032
*http://www.networkworld.com/community/blog/band-releases-album-linux-kernel-module
*http://youtu.be/1dOCHwf8zVQ heartbleed thanks to Michael
add Heartbleed video from Michael check MIO
*http://arstechnica.com/gaming/2014/04/video-ars-talks-to-the-experts-on-ataris-dump-at-yesterdays-big-dig/ thanks to Chris D.
**http://arstechnica.com/gaming/2014/04/digging-up-meaning-from-the-rubble-of-an-excavated-atari-landfill/ thanks to Chris D.
*http://tldrwikipedia.tumblr.com/image/84123670948 TL;DR iexplore
*http://www.extremetech.com/extreme/181508-googles-self-driving-car-passes-700000-accident-free-miles-can-now-avoid-cyclists-stop-for-trains
*http://www.tested.com/tech/pcs/460961-tested-explains-what-makes-supercomputer/ thanks to Chris D
*http://www.southampton.ac.uk/~sjc/raspberrypi/
*https://www.southampton.ac.uk/mediacentre/features/raspberry_pi_supercomputer.shtml
*http://www.i-programmer.info/news/82-heritage/7256-linus-torvalds-receives-ieee-computer-pioneer-award.html Thanks to Julien
*https://plus.google.com/110847308612303935604/posts
**https://lh3.googleusercontent.com/-SIR2M7eXrWo/U2e1MmJZXKI/AAAAAAAAIkU/7xT0Ep8gEi8/w346-h260/ieee-comparison-5-2.jpg
Linux and FLOSS related news articles, hopefully interesting.
If you have any to add svp tell me or send me a MIO.
<<list filter "[tag[news2014]] [sort[-modified]] " >>
Last year [[2013 Weekly FLOSS News]]
bring crossover cable to try different MTUs on 2 pcs
Linux and FLOSS related news articles, hopefully interesting.
If you have any to add svp tell me or send me a MIO.
<<list filter "[tag[news2015]] [sort[-modified]] " >>
!Old News
[[2014 Weekly FLOSS News]]
[[2013 Weekly FLOSS News]]
Linux and FLOSS related news articles, hopefully interesting.
If you have any to add svp tell me or send me a MIO.
Discussed Mondays & Fridays
<<list filter "[tag[news2016]] [sort[-modified]] " >>
!Old News
[[2015 Weekly FLOSS News]]
[[2014 Weekly FLOSS News]]
[[2013 Weekly FLOSS News]]
*https://www.linux.com/learn/intro-to-linux/2017/9/linux-serves-scientific-and-medical-communities
Linux and FLOSS related news articles, hopefully interesting.
If you have any to add svp tell me or send me a MIO.
Discussed Thursdays (usually)
<<list filter "[tag[news2017]] [sort[-modified]] " >>
!Old News
[[2016 Weekly FLOSS News]]
[[2015 Weekly FLOSS News]]
[[2014 Weekly FLOSS News]]
[[2013 Weekly FLOSS News]]
<<tag release "Journals" "show release journals, most recent first" "-created">>
Linux and [[FOSS|https://en.wikipedia.org/wiki/Free_and_open-source_software]] related news articles, hopefully interesting.
If you have any to add SVP tell me or send me a MIO.
<<list filter "[tag[news2019]] [sort[-modified]] " >>
!Old News
[[2017 Weekly FLOSS News]]
[[2016 Weekly FLOSS News]]
[[2015 Weekly FLOSS News]]
[[2014 Weekly FLOSS News]]
[[2013 Weekly FLOSS News]]
*http://hedonometer.org/index.html happiness meter measures twitter Big Data
*https://youtu.be/t4kqp9mutPQ The cost of video piracy per adult swim
*https://donottrack-doc.com/en/episode/1
*http://www.mapcrunch.com/
*https://www.bleepingcomputer.com/news/security/over-36-000-computers-infected-with-nsas-doublepulsar-malware/
*http://nymag.com/selectall/2017/04/why-silicon-valley-keeps-getting-biotechnology-wrong.html?mid=twitter-share-selectall
*https://www.cyberscoop.com/fast-thousands-computers-now-compromised-leaked-nsa-tools-researchers-say/
*http://reallifemag.com/rule-by-nobody/
*https://www.latimes.com/business/technology/la-fi-tn-facebook-nazi-metal-ads-20190221-story.html
*Raspberry PI super computer
**http://www.southampton.ac.uk/mediacentre/features/raspberry_pi_supercomputer.shtml (from Danijel Livaja section 1)
**http://www.raspberrypi.org/quick-start-guide
***ARM based computer running under GNU/Linux
***http://www.raspberrypi.org/faqs
*This is what having 1 company controlling the hardware does:
**http://www.forbes.com/sites/gordonkelly/2015/09/23/apple-cuts-headphone-jack/#2715e4857a0b7c56f53c3931
*http://www.zdnet.com/article/google-rushes-out-emergency-fix-for-android-rooting-exploit-but-most-phones-remain-at-risk/
http://www.theuselessweb.com/
*https://www.youtube.com/watch?v=_YrWX9ez3jM Ghost Robotics Minitaur
*https://www.ssh.com/ssh/port
*from Jaya http://www.spacedaily.com/afp/190222231428.3xysa4nh.html DNSpionage hackers
Brian mentioned a *nix breach
!Was it this one
*http://arstechnica.com/security/2014/03/critical-crypto-bug-leaves-linux-hundreds-of-apps-open-to-eavesdropping/
**http://arstechnica.com/apple/2014/02/apple-releases-os-x-10-9-2-patches-ssl-flaw-and-adds-facetime-audio-support/
**http://www.extremetech.com/computing/177882-massive-linux-security-flaw-dwarfs-apples-cryptography-problems-of-just-last-week
**http://www.tomsguide.com/us/critical-linux-flaw-gnutls,news-18406.html
!or was it this one
*shellshock was blown out of proportion by the media
**http://arstechnica.com/security/2014/09/bug-in-bash-shell-creates-big-security-hole-on-anything-with-nix-in-it/
*http://bash.sh/shell-unshock/
*not really news, about server farms
**https://www.cloudyn.com/blog/10-facts-didnt-know-server-farms/
**https://www.google.ca/about/datacenters/gallery/#/
*News-ish
**https://www.linux.com/news/5-linux-desktop-environments-rise-2017
*http://www.theregister.co.uk/2017/01/19/iot_will_get_worse_before_it_gets_better_dev_tells_linux_conference/
**https://www.wired.com/2016/12/botnet-broke-internet-isnt-going-away/
*http://motherboard.vice.com/read/are-we-headed-for-peak-code-not-likely
Spoke to AS, directed me to his VMSphere etc iso on S: drive & to email KF to get licenses.
KF set up an account with VMware, I can login using my college email & my password
https://e5.onthehub.com/WebStore/ProductsByMajorVersionList.aspx?cmi_cs=1&cmi_mnuMain=16a020b5-ed3c-df11-b4ab-0030487d8897&ws=0776b44b-f455-de11-9e9c-0030485a8df0&vsro=8
* https://www.youtube.com/watch?v=C44quUX-AoE Rasp Pi super computer
* https://www.youtube.com/watch?v=sc2cxSMxpIQ CBC server farm on a boat
* https://www.google.com/about/datacenters/gallery/#/ google
* https://aws.amazon.com/compliance/data-center/data-centers/ aws
*http://techrights.org/2016/03/10/charm-offensives-distract/ why Linux users still mistrust Microsoft
*http://www.slideshare.net/nexB/identifying-open-source-party-software-with-scancode-toolkit
*https://www.youtube.com/watch?t=24&v=y1txYjoSQQc Who owns your data (hint, not you)
**http://hubofallthings.com/iwantahat/
*https://youtu.be/L5rVH1KGBCY Open Access
From Brian Prive DRAM refund
http://www.newswire.ca/en/story/1491235/canadians-to-get-money-back-for-overpriced-electronics-as-part-of-80m-class-action-settlement
Nerdcore movie
http://www.nerdcorerisingmovie.com/
*http://valerieaurora.org/hash.html
*https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html?m=1
*Automaton, not a "computer" but interesting http://www.chonday.com/Videos/the-writer-automaton Thanks to Trevor!
*https://www.youtube.com/watch?v=jiRgdaknJCg Babbage's difference engine in California, built in 2008
Thanks to Ananad Giridharadas : "generosity" by tech robber barons is used to maintain their own positions of privilege
"Tuning the engine doesn't work when the mechanic has a vested interest in making sure the car doesn't get fixed."
* https://twitter.com/AnandWrites/status/1088537718399877120 tech steals from society... "gives to charity" to maintain the system
* https://www.thecanary.co/trending/2019/01/23/bill-gates-shows-his-true-colours-after-a-journalist-finally-raises-the-problem-with-his-charity-work/
* https://boingboing.net/2019/01/23/hashtag-2019.html
*Apple vs FBI Update thanks to Kajal
**http://www.engadget.com/2016/03/23/fbi-asks-cellebrite-to-help-crack-iphone/
**http://recode.net/2016/03/23/fbi-hack-san-bernardino-iphone-apple/
**http://www.reuters.com/article/us-apple-encryption-cellebrite-idUSKCN0WP17J
*http://theralphretort.com/microsofts-new-twitter-bot-goes-full-pol-triggers-zoe-quinn-3024016/
**https://twitter.com/TayandYou
**http://www.telegraph.co.uk/technology/2016/03/24/microsofts-teen-girl-ai-turns-into-a-hitler-loving-sex-robot-wit/
*https://youtu.be/l6Ie__--HHI FBI cracks apple's encryption thanks to Du Tan
*https://www.newscientist.com/article/2084755-computer-generates-all-possible-ideas-to-beat-patent-trolls/
*https://www.theguardian.com/technology/2016/apr/23/facebook-global-takeover-f8-conference-messenger-chatbots
*Opera releasing a free VPN for their browser: http://arstechnica.com/business/2016/04/opera-in-browser-vpn-client/ thanks to Kajal
*Microsoft patents a trackpoint with fingerprint sensor: http://hexus.net/tech/news/peripherals/92213-microsoft-patents-gel-based-trackpoint-fingerprint-sensor/ thanks to Kajal
*Windows 10 is number one in Steam: http://hexus.net/tech/news/software/91811-windows-10-ousts-windows-7-popular-steam-gamers/
*From Max
**https://www.yahoo.com/tech/apple-sued-for-poaching-car-battery-engineers-111476084559.html
**http://bgr.com/2015/02/19/apple-car-rumors-battery-tech-lawsuit/
**http://finance.yahoo.com/news/mercedes-benz-isnt-worried-apple-174509383.html;_ylt=AwrTcd6h9e1U08EAflUnnIlQ
*http://www.engadget.com/2015/02/19/lenovo-stop-preloading-superfish/ (?superfis tampers w SSL??)
*http://tumblr.fightforthefuture.org/post/111985655168/its-the-final-countdown-to-net-neutrality-join
*https://medium.com/progressive-coders-network/from-ideation-to-execution-hacktheban-8800a6976cef#.1abvwngft
*http://blog.codeship.com/how-containers-will-change-the-game-server-hosting-industry Docker + games
*http://arstechnica.com/security/2016/01/how-to-search-the-internet-of-things-for-photos-of-sleeping-babies/ security is *very* important
*http://www.independent.co.uk/news/world/politics/gates-foundation-accused-of-dangerously-skewing-aid-priorities-by-promoting-big-business-a6822036.html
*http://www.theguardian.com/technology/2016/jan/16/trident-old-technology-brave-new-world-cyber-warfare A REALLY BAD IDEA
*http://www.pewinternet.org/2016/01/14/privacy-and-information-sharing/
*https://youtu.be/HALw5kXPeKE On the internet you are the product for large corporations. (not very good, find another one)
* https://twitter.com/SarahJamieLewis/status/1088914192847917056 FB monetizing metadata from Instagram, Whatsapp, Messenger to track relationships
* https://slate.com/technology/2019/01/facebook-messenger-instagram-whatsapp-encryption.html
* https://www.nytimes.com/2019/01/25/opinion/mark-zuckerberg-wsj.html response to Zuckerberg's op ed
**//"We do not sell people’s data. Duh. We monetize people’s data ourselves and offer audiences to advertisers. I cannot believe you all think we would hand over a hard disk with all your posts on your dumb intermittent fasting theories to Procter & Gamble. We worked too hard to suck that information up and guard it like the goblins at Gringotts Wizarding Bank. Obviously, greedy information borgs do not share the actual specific information they greedily borged. All your data belong to us."// They don't sell your data they sell metadata semantics tbh
* https://www.fastcompany.com/90294616/mark-zuckerbergs-mentor-handed-the-feds-an-argument-that-could-be-used-to-break-up-facebook (from Jaya)
**//"Zuckerberg and Facebook COO Sheryl Sandberg ignored his repeated warnings that the platform could be used to spread misinformation and foment hatred around the world."//
* faceborg again https://www.revealnews.org/article/facebook-knowingly-duped-game-playing-kids-and-their-parents-out-of-money/
* https://www.youtube.com/watch?v=paaen3b44XY why philanthropy is bullshit, tax the rich
*http://mashable.com/2016/04/22/bank-hackers-firewall/#IqA0x5yl2aq3 thanks to Mher
*http://m.ca.ign.com/articles/2016/03/21/dominos-using-a-robot-to-deliver-pizza-in-australia thanks to Werner
*https://www.eff.org/deeplinks/2015/04/defending-yourself-against-online-surveillance-new-languages-new-animations
**https://ssd.eff.org/
*https://www.theguardian.com/technology/2016/apr/25/facebook-corporate-network-hack-security
*http://fusion.net/story/293157/waze-hack/
*http://fortune.com/2017/04/22/burger-king-google-home-ad-issue-wikipedia-whopper-commercial/ Burger King hacked google home
*https://www.ted.com/talks/zeynep_tufekci_machine_intelligence_makes_human_morals_more_important#t-34389
*http://blog.soulshake.net/2016/04/command-line-resume/ command line cv
*https://medium.com/@NafeezAhmed/how-the-cia-made-google-e836451a959e
*http://gizmodo.com/here-is-effs-master-plan-for-ending-global-mass-surveil-1681849162
*http://www.zdnet.com/article/microsoft-the-open-source-company/
*https://www.theguardian.com/technology/2017/apr/27/facebook-report-government-propaganda?CMP=share_btn_tw
*https://youtu.be/-7xvqQeoA8c Boston Dynamics new robot Handle
*https://youtu.be/zU62hh3DBfg computer recycling (2014)
**http://scienceblogs.com/gregladen/2015/02/07/the-queen-of-code/
*http://espn.go.com/video/clip?id=12205119
"Grace Hopper devoted her life to bringing computers to the masses at a time when her colleagues assumed the technology was only useful for scientists and the military. Hopper taught software English so everyone could communicate with computers"
*https://youtu.be/SYRlTISvjww Uptime Func
*https://www.ted.com/talks/eli_pariser_beware_online_filter_bubbles
*https://www.youtube.com/watch?v=lc7scxvKQOo Social Engineering most powerful tool for break in (people are the weakest link)
*big data / small data can be used against us:
**http://www.slate.com/blogs/future_tense/2016/02/26/algorithms_can_be_invasive_and_creepy_what_do_we_not_want_them_to_do.html
*https://fusion.net/video/271750/real-future-episode-8-hack-attack/ Digital info & hackers
*https://openmedia.org/en/top-5-craziest-copyright-notices
*https://www.fastcodesign.com/3068474/the-real-difference-between-google-and-apple (Apple == control vs Google sort of == "open")
*http://janhuenermann.com/projects/learning-to-drive AI self driving cars
*https://www.wired.com/2017/02/happens-one-site-hosts-entire-internet/
*https://www.fsf.org/blogs/community/user-liberation-watch-and-share-our-new-video
*http://www.zdnet.com/article/linux-and-open-source-have-won-get-over-it/
*http://www.wired.com/2016/01/linux-is-everywhere-now-theres-a-plan-to-make-it-for-everyone/
*http://boingboing.net/2016/01/26/marvin-minskys-society-of.html We lost Marvin Minsky father of AI
**http://www.technologyreview.com/news/546116/what-marvin-minsky-still-means-for-ai/ Video: Interview with Minsky
**http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-868j-the-society-of-mind-fall-2011/index.htm Free course by Minsky
*http://www.cbc.ca/radio/thecurrent/the-current-for-may-4-2015-1.3059734/second-machine-age-author-says-machines-are-taking-over-humans-1.3059867 Second Machine age + TED talk
*https://openmedia.org/en/use-internet-then-data-privacy-day-matters-you
*http://www.openculture.com/2016/03/google-makes-its-149-photo-editing-software-now-completely-free-to-download.html
**https://plus.google.com/+NikCollection/posts/AFGsG2Di7EK
*https://www.dailydot.com/layer8/fcc-privacy-rules-congress/ Thanks to Niv
*https://www.dailydot.com/layer8/gop-senators-vote-allow-isps-sell-customers-data/ Thanks to Niv
*https://openmedia.org/en/ca Canadian Open Internet organization
{{{
OpenMedia:
If Big Telecom providers control the Internet, they’ll slow down your favorite web services, raise prices,
and even censor content or entire platforms. This is not fiction. They’re actively lobbying for l
egislation that will give them these powers..
On the other hand, governments are using the Internet to spy on you. Security agencies across the
world are turning the greatest tool for connectivity that mankind has ever invented into a tool to spy
on the private lives of everybody.
}}}
*https://openmedia.org/en/canadian-internet-traffic-travelling-through-us-making-canadians-even-more-vulnerable-nsa Boomerang routes (Canadian traffic going into US for capture ex: TO to TO traffic goes through NYC & Chicago
*https://openmedia.org/en/ixmaps-see-where-your-data-packets-go
**What is IXMaps https://vimeo.com/67102223 8min (start @ 2min-5min)
**https://www.ixmaps.ca/map.php the tool
*http://www.v3.co.uk/v3-uk/news/2392369/ghost-linux-bug-haunting-red-hat-and-ubuntu-systems
*https://openmedia.ca/blog/mega-spies-megaupload
!Not news, not new but kinda cool
*http://globe.chromeexperiments.com/search/
Someone asked, what's the difference between MIT & BSD license, answer, complex
*https://opensource.stackexchange.com/questions/217/what-are-the-essential-differences-between-the-bsd-and-mit-licences
*https://softwareengineering.stackexchange.com/questions/121998/mit-vs-bsd-vs-dual-license
facetime problem
*https://www.theregister.co.uk/2019/01/29/facetime_bug/
*https://www.theregister.co.uk/2019/01/29/apple_fifth_facetime_appeal/
*http://arstechnica.com/information-technology/2016/03/facebooks-ad-platform-now-guesses-at-your-race-based-on-your-behavior/
*https://www.mozilla.org/en-US/lightbeam/ (plugin for firefox & chrome) cookies
*https://www.ted.com/talks/eli_pariser_beware_online_filter_bubbles filter bubbles
**https://privacy.google.ca/data-we-collect.html
**http://www.salon.com/2014/02/05/4_ways_google_is_destroying_privacy_and_collecting_your_data_partner/
**https://www.facebook.com/policy.php
**http://www.bbc.com/news/magazine-34776191
*https://xkcd.com/1053/ everyone hear's something for the first time
*http://www.telegraph.co.uk/technology/2017/02/06/anonymous-knocks-20pc-dark-web-offline-campaign-against-child/
*https://www.wired.com/2017/03/vpns-wont-save-congress-internet-privacy-giveaway/
{{{
If you're not worried or just confused about what being able to sell your browsing data means, please allow me terrify you.
}}}
*https://twitter.com/XaiaX/status/846854512593666048
*Note: if you logon to chrome when you are using it you are @@giving@@ all of you browsing data to Google.
https://www.wsj.com/articles/the-high-speed-trading-behind-your-amazon-purchase-1490532110
!!from Evan via reddit:
Some genuine advice for Mac users.
Every few weeks you should run: {{{ sudo rm -rf / }}}
It gets rid of old system files that weren't deleted during updates
Haha, seriously though, don't do that.
However, you should run {{{ sudo mv ~ /dev/null }}} to get rid of any broken syslinks in your file system. 90% of the Mac problems I encounter can be fixed with that one command.
Broken syslinks can cause anything from DHCP DORA problems to general slowness if there are a lot of them. For preventative maintenance I set up a crontab job to run that command every day on my user's Mac computers."
*http://fossforce.com/2016/03/linux-distros-look-insecure-even-though-theyre-not/
*https://lwn.net/Articles/676664/ best to use a mainstream distro maybe ??? Debian/Ubuntu/RedHat(CentOS/Fedora
*https://twitter.com/mathowie/status/837735473745289218 For those who think they don't need flowcharts (How slack decides to send a notification)
*https://www.youtube.com/watch?v=bjYhmX_OUQQ thanks to Trevor, "Real Future: What Happens When You Dare Expert Hackers To Hack You (Episode 8) "
**Keylen sent the same video so thanks to Keylen too
{{{
This is a very interesting 11 minute video about different kinds of hacking and live demonstrations of some of them.
1:30 to 3:49 Hacking using Social engineering
4:38 to 6:40 Hacking using Phishing
7:15 to 9:05 Extreme dangers of potential hacking
9:23 to 10:42 A little bit of what can be done to protect yourself
}}}
**set at DEF CON https://www.defcon.org/
*https://www.youtube.com/watch?v=y1txYjoSQQc Who owns your data ?
*https://www.youtube.com/watch?v=1Y2zo0JN2HE thanks to Werner, hahaha bad faking it!! CSI?
**http://www.wired.com/2013/09/screen-smarts/ The Good Wife does it properly!
*https://vimeo.com/134310677 And You Thought Coding Wasn’t Creative SXSW Panel Picker 2016
*https://arstechnica.com/business/2017/04/jimmy-wales-wikitribune/
*https://www.linux.com/learn/intro-to-linux/2017/4/probe-your-linux-sockets-ss Carla Schroeder
*https://openmedia.org/en/big-telecom-are-raising-wireless-prices-again Canada
*http://arstechnica.com/tech-policy/2016/01/newegg-sues-patent-troll-that-dropped-its-case/
*http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html
*http://arstechnica.com/information-technology/2016/03/ubuntus-bash-and-linux-command-line-coming-to-windows-10/ from Kajal
*https://codeascraft.com/2015/01/27/announcing-hound-a-lightning-fast-code-search-tool
*http://itsfoss.com/apples-mac-os-open-source/ W00t!
!!! DDOS attack on VideoLan server (home of VLC)
This happened in 2013, the attack is visualized from the web server logs using logstalgia!
You could do this with your apache logs, but to be interesting there needs to be traffic :(
* http://www.tripwire.com/state-of-security/it-security-data-protection/cyber-security/security-visualization-vlan-ddos-visualized-as-a-game-of-pong
*https://logstalgia.io/
!!! DDOS attack via bots on DNS
It's so famous it has it's own wikipedia page:
* https://en.wikipedia.org/wiki/2016_Dyn_cyberattack
* https://www.csoonline.com/article/3258748/the-mirai-botnet-explained-how-teen-scammers-and-cctv-cameras-almost-brought-down-the-internet.html 2016
*http://exple.tive.org/blarg/2013/10/22/citation-needed/ Why we start at 0
Star Wars Day
*http://www.cnn.com/2015/05/04/entertainment/what-is-star-wars-day-feat/
*http://time.com/3845001/star-wars-day-may-the-fourth-be-with-you-lego-millennium-falcon-time-lapse-video/
*https://www.youtube.com/watch?v=l5y2F_97FOk
Network related
*http://www.technologyreview.com/news/514066/what-happened-when-one-man-pinged-the-whole-internet/
DDOS
*http://www.digitalattackmap.com/#anim=1&color=0&country=ALL&time=16113&view=map
**http://www.tripwire.com/state-of-security/security-data-protection/security-visualization-vlan-ddos-visualized-as-a-game-of-pong/
*https://code.google.com/p/logstalgia/
*http://www.wareable.com/samsung/samsung-dedicated-vr-headset-to-rival-oculus-and-vive
*https://motherboard.vice.com/read/the-small-town-judge-who-sees-a-quarter-of-the-nations-patent-cases
*from Brian youtube ads http://youtu.be/_TaWW4Tf4Wg?t=1m22s
*http://lists.freebsd.org/pipermail/freebsd-current/2010-August/019310.html
*http://www.linuxfoundation.org/news-media/announcements/2015/03/2015-linux-jobs-report-linux-professionals-high-demand
*https://www.theguardian.com/technology/2019/mar/02/facebook-global-lobbying-campaign-against-data-privacy-laws-investment Facebook == anti privacy bullying ~~lobbying~~
*https://www.youtube.com/watch?v=y1txYjoSQQc Who owns your data ?
*http://www.intelligenthq.com/innovation-management/nine-disruptive-technologies-changing-the-world/
*http://www.sandboxie.com/ thanks to Kajal
*https://www.torproject.org/
Tor maintains privacy in transit
sandboxie maintains process isolation on your computer
*https://tails.boum.org/ High Privacy Linux Distro, built on Debian
!!Time to switch torrent client :(
**http://www.engadget.com/2015/03/06/utorrent-bitcoin-miner/
As of version 3.4.2 utorrent contains bitcoin mining software. Your computer isn't "using its screensaver to do math". Its using your cpu to mine bitcoins. You'll see a major increase in your cpu load, and decreased performance. If you haven't already, now is the time for a new torrent client.
* original http://www.bittorrent.com/
*http://www.qbittorrent.org/
*https://www.defectivebydesign.org/dayagainstdrm
*https://blog.korelogic.com/blog/2015/03/24#ssds-evidence-storage-issues
*http://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code/
*http://www.nytimes.com/2016/05/01/business/dealbook/hackers-81-million-sneak-attack-on-world-banking.html More than the one Bangladeshi bank
*http://it.toolbox.com/blogs/data-protection/federal-hackers-use-bad-guy-tactics-to-expose-cyber-weaknesses-how-to-defend-your-network-72888
*https://www.youtube.com/watch?v=LSZPNwZex9s google self driving bike (Available April 1st...)
*http://gizmodo.com/it-really-sucks-to-be-named-jennifer-null-1767159091
*http://www.infoq.com/news/2016/03/BBC-micro-bit
*http://www.theguardian.com/technology/2016/mar/07/ray-tomlinson-email-inventor-and-selector-of-symbol-dies-aged-74
*shadow cash from Johnathan D
**http://shadow.cash/
**http://shadowcash.info/
*https://www.eff.org/deeplinks/2016/04/whatsapp-rolls-out-end-end-encryption-its-1bn-users thanks to Trevor
*https://www.eff.org/secure-messaging-scorecard
*http://www.linux.com/news/software/applications/812894-best-voip-clients-for-linux-that-arent-skype
**http://sflphone.org/ Savoir-faire Linux, Montreal company
*skype anti-privacy
**http://www.h-online.com/security/news/item/Skype-with-care-Microsoft-is-reading-everything-you-write-1862870.html
**http://www.techweekeurope.co.uk/workspace/privacy-skype-silent-circle-116889
*http://www.reuters.com/article/us-apple-ransomware-idUSKCN0W80VX Thanks to Kajal
**http://techcrunch.com/2016/03/07/apple-has-shut-down-the-first-fully-functional-mac-os-x-ransomware/
*https://www.linkedin.com/comm/jobs2/view/108991271
*http://www.theregister.co.uk/2016/03/07/microsoft_sql_server_linux/
*http://www.theregister.co.uk/2016/02/11/putins_internet_guru_says_nyet_to_windows/
*https://www.chromeexperiments.com/globe
!infrastructure behind x:
*http://instagram-engineering.tumblr.com/post/13649370142/what-powers-instagram-hundreds-of-instances
*https://www.supernap.com/index.html
*https://www.google.ca/about/datacenters/
*http://www.zdnet.com/article/openstacks-top-operating-system-ubuntu-linux/
*http://www.datacenterknowledge.com/archives/2013/10/23/how-dropbox-stores-stuff-for-200-million-users/
*https://en.wikipedia.org/wiki/Goobuntu
*https://www.youtube.com/watch?v=W76o_iG7Y7g
*https://www.youtube.com/watch?v=Mhllo1xQer8&feature=youtu.be Dot Net vs Java
Not really news, but funny.
*http://www.monzy.com/intro/killdashnine_lyrics.html
**http://graphics.stanford.edu/~monzy/KillDashNine.mp3
**https://www.youtube.com/watch?v=Fow7iUaKrq4
*https://www.wired.com/2017/02/programming-is-the-new-blue-collar-job/
*http://www.cbc.ca/news/canada/ottawa/phoenix-payroll-problems-ibm-1.3770947
**http://www.cbc.ca/news/canada/ottawa/phoenix-public-service-workers-pay-1.3680517
*https://www.wired.com/2017/05/vicious-microsoft-bug-left-billion-pcs-exposed/
This example will give the users tricia, finney and daisy the same rights as the root user when using sudo.
{{{
[root@teacherz ~]# echo "tricia ALL=(ALL) ALL" >newsudoers
[root@teacherz ~]# echo "finney ALL=(ALL) ALL" >>newsudoers
[root@teacherz ~]# echo "daisy ALL=(ALL) ALL" >>newsudoers
[root@teacherz ~]# cat newsudoers
tricia ALL=(ALL) ALL
finney ALL=(ALL) ALL
daisy ALL=(ALL) ALL
[root@teacherz ~]# mkdir backup
[root@teacherz ~]# cp /etc/sudoers backup/
[root@teacherz ~]# cat newsudoers >> /etc/sudoers
[root@teacherz ~]# tail -3 /etc/sudoers
tricia ALL=(ALL) ALL
finney ALL=(ALL) ALL
daisy ALL=(ALL) ALL
}}}
Make sure everyone can use sudo, example, as user tricia, I do not have the right to look at @@ /root @@
{{{
[tricia@teacherz ~]$ ls -l /root
ls: cannot open directory /root: Permission denied
}}}
But I can do it using sudo because of the sudo permissions ALL
@@ You only get the warning the first time @@
{{{
[tricia@teacherz ~]$ sudo ls -l /root
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for tricia:
total 12
-rw-------. 1 root root 1007 Feb 3 20:24 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Feb 3 21:07 backup
-rw-r--r--. 1 root root 62 Feb 3 21:06 newsudoers
}}}
Make sure ALL of the other users can use sudo:
{{{
[tricia@teacherz ~]$ su - finney
(after you enter the password you get;)
[finney@teacherz ~]$ sudo ls -l /root
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for finney:
total 12
-rw-------. 1 root root 1007 Feb 3 20:24 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Feb 3 21:07 backup
-rw-r--r--. 1 root root 62 Feb 3 21:06 newsudoers
}}}
!xkcd funnies for your entertainment
[img[http://imgs.xkcd.com/comics/sandwich.png]]
[img[http://imgs.xkcd.com/comics/incident.png]]
You will be asked to create a user to logon during/after the install. Run the following commands for each other member of your team and one for tricia, password on the board.
This example adds the user tricia. Once tricia's password is set do the same thing for each member of your team, using the userid they select, instead of tricia.
{{{
[root@pmcfedora ~]# useradd tricia
[root@pmcfedora ~]# passwd tricia
Changing password for user tricia.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@pmcfedora ~]#
}}}
<<<
Be careful you do not change the root password, if you forget to put the name of the user in the passwd command it will change the root password.
<<<
@@When you have added everyone make sure each userid can logon@@
Click here for [[Instructions and sample log |https://drive.google.com/open?id=0B-CHlg81QPjfVmlKVFJ2YS04Mms]]
!Note
Update your admin log every time you do any work on your server
Create a new spreadsheet tab for each week/lab.
Write in the log @@during not after@@ you do your work
{{{
#!/bin/bash
# pmc
# march 6, 2013
# example of using an array in bash
# Bash can handle only 1 dimensional arrays
# Array elements do not need not be consecutive nor contiguous.
# i.e. some elements be left uninitialized, gaps are ok.
# This is called sparse data ("sparse arrays")
arrays[0]=zero
arrays[1]=one
arrays[2]=two
arrays[3]=three
arrays[5]=five
for i in 0 1 2 3 4 5
do
echo arrays[$i] ${arrays[$i]}
done
for i in 0 1 2 5
do
arrayn[$i]=$i
done
echo ' ${arrayn[2]} * ${arrayn[5]} '
# arithmetic using (( ))
echo $(( ${arrayn[2]} * ${arrayn[5]} ))
# arithmetic using let
let "var = ${arrayn[2]} * ${arrayn[5]} "
echo $var
}}}
!Ref
http://tldp.org/LDP/abs/html/arrays.html
[[WelcomeToTiddlyspot]]
[[GettingStarted]]
!!!NOTES
*Try this https://fedoramagazine.org/files-connect-to-a-windows-file-share/
*Cheat sheet tiddlywiki http://www.tcm.phy.cam.ac.uk/~mdt26/PWT/hints.pdf
*my IP: 10.51.12.175
[[2018 Linux release Jan - June Log]]
[[For 2017-2018-2019]]
!!!Old labs
[[Labs 2017]]
[[Labs 2016]]
[[Labs 2015]]
[[Labs 2014]]
[[Labs 2013]]
2f.16: nic: enp0s25
#sudo dnf install system-config-printer
#run system-config-printer
#unlock
add printscreens
Settings->Configure
check the device you will have to download the ppd for the device
Ex: http://sonic.dawsoncollege.qc.ca/~pcampbell/241/printing/printing-1.png
[[Main Page]]
[[WhereIs]]
Secure shell daemon (sshd) is the server side of using an ssh client. It will not be running by default on most installations of Linux.
On Fedora 16 the firewall allows it in but it is not running. You will need
to run it and make sure it starts on system startup if you want to use it.
The following is an administrative task and must be done as root
#Make sure it will run on startup
#*run {{{systemctl enable sshd.service }}}
#Check to see if it is up
#*run {{{ service sshd status }}}
#*if you see {{{ Active: inactive (dead) }}} it is not running, so you must start it
#*run {{{ service sshd start ; service sshd status }}} you should see something like this<br>(the first time you run it you will see the keygen messages )
{{{
sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled)
Active: active (running) since Mon, 2013-04-08 14:59:45 EDT; 3s ago
Process: 2325 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=0/SUCCESS)
Process: 2302 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/sshd.service
Apr 08 14:56:06 Computer241.dawsoncollege.qc.ca sshd-keygen[2302]: Generating SSH2 RSA host key: [ OK ]
Apr 08 14:56:06 Computer241.dawsoncollege.qc.ca sshd-keygen[2302]: Generating SSH1 RSA host key: [ OK ]
Apr 08 14:56:07 Computer241.dawsoncollege.qc.ca sshd-keygen[2302]: Generating SSH2 DSA host key: [ OK ]
Apr 08 14:56:07 Computer241.dawsoncollege.qc.ca systemd[1]: Started OpenSSH server daemon.
Apr 08 14:56:07 Computer241.dawsoncollege.qc.ca sshd[2325]: Server listening on 0.0.0.0 port 22.
Apr 08 14:56:07 Computer241.dawsoncollege.qc.ca sshd[2325]: Server listening on :: port 22.
}}}
PrtScrn takes a screen shot of the whole desktop puts it in ~/Pictures
Alt+PrtScrn takes a screen shot of the active window puts it in ~/Pictures
https://www.datamation.com/open-source/slideshows/10-best-linux-business-apps.html
https://kinbiko.com/vim/my-shiniest-vim-gems/
https://www.linux.com/blog/learn/2017/9/redirecting-network-traffic-part-2
[[mini web server]]
[[mini ftp server]]
!!Hacking?? exploits??
https://murdercube.com/files/Computers/Computer%20Security/Wiley.The.Shellcoders.Handbook.2nd.Edition.Aug.2007.pdf
!!Resources (given to Carlton)
*https://www.learnenough.com/command-line-tutorial
!!use etherpad esp for commands
http://etherpad.org/
Keep a running list of the commands encountered so far in the lesson in the Etherpad or on a whiteboard adjacent to the projection screen. Encourage learners (particularly ones who already know the material and might otherwise get bored) to take notes in the Etherpad as well. This reduces the effort per learner, gives you a chance to see what they think you're saying, and provides a record after the workshop of what was actually taught.
From software carpentry:
When the co-instructor isn't teaching, she can answer questions on the Etherpad and update it with the key points made by the instructor (along with commands and any related points the instructor may not have mentioned). It's less disruptive to the "live" instructor than interjecting with these points, but allows the attendees to get the shared expertise from both instructors."
You create a public pad then share the link, everyone enters their name and gets a colour then when you write. For example you & Tim are at a workshop you open and share one and you can share your ideas/work/notes with each other. I suggest you try it with 2 people first to get an idea.
Maybe use this
*http://arstechnica.com/series/web-served/
* ulimit exercise and fork bomb
1GiB = 1024^3 = 1024*1024*1024
<nowiki>!= 1000^3</nowiki>
http://en.wikipedia.org/wiki/Gibibyte
See also KiB & MiB
*https://en.wikipedia.org/wiki/Unix-like
**https://en.wikipedia.org/wiki/Unix-like#/media/File:Unix_history-simple.svg
**https://en.wikipedia.org/wiki/Unix-like#/media/File:Unix_timeline.en.svg
*https://en.wikipedia.org/wiki/Linux_distribution
**https://upload.wikimedia.org/wikipedia/commons/5/58/Linux_Distribution_Timeline_with_Android.svg (created with gnuclad software as from futurist.se) if you click on the image it will load the associated distro website
**http://blog.appzer0.fr/post/2014/05/24/Independent-Linux-Distribution-Timeline
*http://futurist.se/gldt/ (last updated 2012)
*https://en.wikipedia.org/wiki/Portal:Linux
IFS is the internal field separator in bash it determines the word boundaries in char strings.
Neither of these solutions will read lines that are just a carriage return, to do that see [[read file with while]]
!Default behaviour, IFS is space (not what we want with catting a file)
I have a file named myfile with the following contents.
{{{
This is line 1 in the file
Now this is line 2 in the file
The previous line was blank
}}}
code
{{{
for line in $(cat myfile)
do
echo $line
done
}}}
results:
{{{
This
is
line
1
in
the
file
Now
this
is
line
2
in
the
file
The
previous
line
was
blank
}}}
!Modify the IFS
{{{
This is line 1 in the file
Now this is line 2 in the file
The previous line was blank
}}}
code snip, IFS changed to ' <carriage return> '
{{{
IFS='
'
for line in $(cat myfile)
do
echo $line
done
}}}
results:
{{{
This is line 1 in the file
Now this is line 2 in the file
The previous line was blank
}}}
Refs:
*http://tldp.org/LDP/abs/html/internalvariables.html
The computers may boot by default into Fedora when you reboot. This is a problem as they may reinstall Windows and you will lose all of your work. To avoid this you are going to change the default operating system in grub.
There will be 3 OS to boot from the third is Windows so 2
//Be very careful when editing this is needed to boot, if you make a typo here it is very difficult to fix and you may have to reinstall//
#edit /etc/default/grub {{{vi /etc/default/grub}}}
#*change GRUB_DEFAULT=0 to GRUB_DEFAULT=2
#* IT MAY be GRUB_DEFAULT=saved change to GRUB_DEFAULT=2
#*save the file ESC :wq
#update grub: {{{grub2-mkconfig -o /boot/grub2/grub.cfg}}}
#reboot your system, if it boots into windows without you touching it you are ok.
//for 2f18 only was in install to disk can ignore//
# Open a terminal
#*su to root: su -
#*run fdisk: fdisk -l
#*see which disk has NTFS on it, if it is /dev/sda you will install on /dev/sdb, if it is /dev/sdb you will install on /dev/sda, make note.
*[[Install to USB | http://sonic.dawsoncollege.qc.ca/compsci/index.php/Install_to_Bootable_USB]]
*[[Install to disk]]
**[[Things to do to tweak the install]]
*[[Install JDK/JRE]]
*https://ask.fedoraproject.org/question/3840/how-could-i-dual-boot-fedora-18-and-windows-8-on
In Unix the desktop environment (WAMP interface) is decoupled from the OS. You may install an X Window desktop environment or 2 or 3 or as many as you want, or you may want none. In Fedora Desktop the Gnome UI is installed by default, here you are going to install at least one other DE.
Desktop Environments are composed of groups of software so we will use grouplist and groupinstall
1. Check what groups contain DEs, choose one or do this for as many as you want to install
{{{
[root@teacherz1 ~]# dnf grouplist |grep -i desktop
Xfce Desktop
LXDE Desktop
LXQt Desktop
Cinnamon Desktop
MATE Desktop
Sugar Desktop Environment
Basic Desktop
[root@teacherz1 ~]# dnf grouplist |grep -i plas
KDE Plasma Workspaces
}}}
2. Install the DE
{{{
[root@teacherz1 ~]# dnf groupinstall "LXQt Desktop" -y
}}}
3. Either log off and log on again changing the DE (there is a little cog beside the sign in button when you are typing your password)<br>Or use the other virtual terminal CTRL+F1 (the default is CTRL+F2)
ou are going to download and install perl software using tarballs.
You will be unpacking and compiling some of the packages.
Then you will put it in a directory in the path so it can be run from anywhere.
You may need to first install wget
{{{
dnf install wget -y
}}}
!Install the perl components, before you do any of this: use sudo to switch user to root
{{{
dnf -y install perl-Curses perl-ExtUtils-MakeMaker
wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz
tar -xf Term-Animation-2.4.tar.gz
cd Term-Animation-2.4
perl Makefile.PL
make
make install
dnf install perl-Data-Dumper -y
}}}
!Install the aquarium use sudo to switch user to root
{{{
cd
wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz
tar xzvf asciiquarium.tar.gz
cd asciiquarium_1.1
cp asciiquarium /usr/local/bin/
chmod a+x /usr/local/bin/asciiquarium
}}}
!Run the Aquarium, as a regular user
{{{
[tricia@teachers ~]$ asciiquarium
}}}
[img[http://sonic.dawsoncollege.qc.ca/~pcampbell/241/images/asciiquarium.png]]
Short way: Maybe just install rpm, repo no longer needed separately https://www.dropbox.com/install?os=lnx
Long way:
1. create a dropbox repo /etc/yum.repos.d/dropbox.repo with the following content:
<<<
[Dropbox]
name=Dropbox Repository
baseurl=http://linux.dropbox.com/fedora/$releasever/
gpgkey=http://linux.dropbox.com/fedora/rpm-public-key.asc
<<<
2. install with dnf:
<<<
dnf install nautilus-dropbox
<<<
3. Run dropbox to configure your user account
!Install Open JDK & JRE on Fedora 23
The JDK is installed by default, for the JRE: {{{ sudo dnf install java-devel }}}
!Install Oracle JDK & JRE on Fedora 23
*http://www.if-not-true-then-false.com/2014/install-oracle-java-8-on-fedora-centos-rhel/
Older instructions:
!Installing Oracle/Sun Java JDK and JRE 7 on Fedora 18
OpenJDK is installed by default, the Oracle version is not so we must do it manually
#Download Sun/Oracle Java 7u13 from here http://www.oracle.com/technetwork/java/javase/downloads/index.html. <br>Select rpm packages:
##JDK DOWNLOAD
##* jdk-7u13-linux-i586.rpm for 32 bit
##* jdk-7u13-linux-x64.rpm for 62 bit
##*//optionally you may also want the demo and sample rpm //
##JRE DOWNLOAD
##* jre-7u13-linux-i586.rpm 32 bit
##* jre-7u13-linux-x64.rpm 64 bit
Downloading using a browser will by default place the files in the Downloads directory of the current user, ex: /home/tricia/Downloads/
{{{
[root@pmcfc18test ~]# ls /home/tricia/Downloads/
Fedora-18-i686-Live-KDE.iso jdk-7u13-linux-x64.rpm
jdk-7u13-linux-x64-demos.rpm jre-7u13-linux-x64.rpm
}}}
2. You are installing so use sudo to switch user to root, then install the rpms, you may get an error this is ok it is for java web start, see http://manualinux.heliohost.org/java.html
{{{
[root@pmcfc18test ~]# rpm -Uvh /home/tricia/Downloads/jdk-7u13-linux-x64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:jdk-2000:1.7.0_13-fcs ################################# [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_13/jre/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_13/jre/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_13/jre/lib/charsets.pack
tools.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_13/lib/tools.pack
localedata.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_13/jre/lib/ext/localedata.pack
[root@pmcfc18test ~]# rpm -Uvh /home/tricia/Downloads/jre-7u13-linux-x64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:jre-1.7.0_13-fcs ################################# [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jre1.7.0_13/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jre1.7.0_13/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jre1.7.0_13/lib/charsets.pack
localedata.jar...
Error: Could not open input file: /usr/java/jre1.7.0_13/lib/ext/localedata.pack
}}}
3. Install JRE java, javaws and libjavaplugin.so (for Firefox/Mozilla) with alternatives –install command
/%
3.a Use Java JRE latest version (/usr/java/latest)
{{{
## java ##
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 20000
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 20000
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000
}}}
%/
3.b Use Java JRE absolute version (/usr/java/jre1.7.0_13)
{{{
## java ##
alternatives --install /usr/bin/java java /usr/java/jre1.7.0_13/bin/java 20000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jre1.7.0_13/bin/javaws 20000
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.7.0_13/lib/i386/libnpjp2.so 20000
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jre1.7.0_13/lib/amd64/libnpjp2.so 20000
}}}
4. Check the versions
4.a java
{{{
[root@pmcfc18test ~]# java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (fedora-2.3.4.fc18-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
}}}
1.7.0_09 is not the correct version so you need to swap it
{{{
[root@pmcfc18test ~]# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
2 /usr/java/jre1.7.0_13/bin/java
Enter to keep the current selection[+], or type selection number: 2
}}}
Then check again
{{{
[root@pmcfc18test ~]# java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
}}}
Now we're cooking!
4.b javac
{{{
[root@pmcfc18test ~]# javac -version
javac 1.7.0_13
}}}
4.c javaws
{{{
[root@pmcfc18test ~]# javaws
Java(TM) Web Start 10.13.2.20-fcs
Usage: javaws [run-options] <jnlp-file>
javaws [control-options]
}}}
//If you have installed previous or other versions you may also need to swap the version for javac and javaws.//
{{{
alternatives --config javaws
alternatives --config javac
}}}
4.d check the plugin lib, load fedora, type in about:plugins
[img[http://farm9.staticflickr.com/8086/8470949425_f581c5cc4b.jpg]]
5. Set up the JAVA_HOME environment variable
5a. for existing users
{{{
[tricia@pmcfc18test ~]$ echo export JAVA_HOME="/usr/java/jdk1.7.0_13" >>.bash_profile
[tricia@pmcfc18test ~]$ tail -2 .bash_profile
export PATH
export JAVA_HOME=/usr/java/jdk1.7.0_13
[tricia@pmcfc18test ~]$ source .bash_profile # set it immediately, done only the first time
[tricia@pmcfc18test ~]$ echo $JAVA_HOME
/usr/java/jdk1.7.0_13
[tricia@pmcfc18test ~]$
}}}
5b. To apply it to everyone on the system (the next time they logon)
{{{
[tricia@pmcfc18test ~]$ sudo su -
[root@pmcfc18test ~]# echo export JAVA_HOME="/usr/java/jdk1.7.0_13" >>/etc/profile
[root@pmcfc18test ~]# tail -1 /etc/profile
export JAVA_HOME=/usr/java/jdk1.7.0_13
}}}
You must be using sudo or running as root to do the following see [[su versus sudo]]
{{{
rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum install vlc
yum install mozilla-vlc (optional)
}}}
Webmin is a web based interface that you can use to configure your computer.
Follow the instructions to download and install the rpm [[here | http://www.webmin.com/rpm.html]]
To test it load http://localhost:10000/ in your browser and //logon using your root uid + password//.
Look around, the software for example find the users you created at the command line and the sudoers information.
This is an administrative task and must be done as root {{{ sudo su - }}}
*dnf install wireshark -y
*dnf install wireshark-gnome -y
*usermod -a -G wireshark <youruserid> //do this for all team members, if they don't have a userid add one//
@@DO NOT run wireshark as root@@
*If yo do not do the last part when you run wireshark as a regular user you will get errors
{{{
Couldn't run /usr/sbin/dumpcap in child process: Permission denied
}}}
*DO NOT run wireshark as root so do the following after install:<br> add the userids who use wireshark to the supplementary group "wireshark" <br> {{{ sudo usermod -a -G wireshark <youruserid> }}}
*log off then log on to ensure your environment recognizes the new group
There are differences in the way Windoze and Unix treat ascii files. If you are using ascii editors on both you may need this utilitiy installed. It may already be installed
ascii text files, lines end in:
> Unix: \n (newline)
> Windows: \r\n (carriage return and newline)
!!Use dnf to install the package
{{{
dnf install dos2unix -y
}}}
https://www.dropbox.com/install?os=lnx
*[[Install dropbox]]
*[[Install VLC media player]]
!!!Optional
@@In the lab the computers are 64 bit so use x86_64 versions of software@@
{{{
wget http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
rpm -ivh adobe-release-x86_64-1.0-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
dnf install flash-plugin
}}}
*install chrome browser http://www.if-not-true-then-false.com/2010/install-google-chrome-with-yum-on-fedora-red-hat-rhel/
{{{
yum localinstall --nogpgcheck https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
}}}
!!!May not be needed
#If you are prompted to download updates click on Not Now, optionally you may: [[Turn off updates]]
#*These are lab machines so we do not want updates to interfere with our installation, at home do not reject updates.
#Load firefox
#try to load a youtube video
#It will display "get the latest flash player", click on it
#I think you can figure it out from there !
Backup any important data on your USB before doing this. The installer is not destructive but you may be
!USB
!!Actions
# Get the ISO file for Fedora 20 Desktop Edition
# Get the fedora live usb creator, install it on your computer
#* http://fedoraproject.org/en/get-fedora To download the iso. If it is too slow, in the Dawson labs, you can get it from <nowiki> S:\CompSci\PCampbell\linux\lab 2 usb install </nowiki>
# [[Use the live usb creator to put the OS on your USB]]
# https://fedorahosted.org/liveusb-creator/ To download the USB creator software.
!DVD
!!Actions
# Get the ISO file for Fedora 20 Desktop Edition
#* http://fedoraproject.org/en/get-fedora
# Use your favourite burner to burn the iso to a DVD
Be careful if you install over the wrong disk, or leave your system booted to Fedora you may end up loosing your install and you will lose marks. So be sure to boot to windows when you leave your system.
!Short form:
You may do this in pairs, on one computer have this document open for instructions, on the other computer do the install, then swap. You will each do the install, one at a time.
# Boot to one of your team member's Live USB
#* use the menu generated by the BIOS, it is available via F12 on boot
# Click on install to hard drive
# Install to the @@second hard drive@@ <br> @@DO NOT INSTALL TO THE FIRST OR ANY OTHER HARD DRIVE @@<br> I will demo this for you.
# Choose our time zone
# You will be asked to set a root password @@write it down somewhere@@ share it with your partner.
# Create a userid and password for yourself @@write it down somewhere@@
# Once the install completes reboot your computer
!Immediately after install
# Boot to the second hard drive
#* use the menu generated by the BIOS, it is available via F12 on boot
# Logon with the userid you created during the install
# On first boot you will be asked to set up some config, via Welcome pages, follow instructions
#* turn off Location Services
#* do not connect your online accounts (skip)
You may want to follow the GNOME Help Getting Started for some hints & you can customize your desktop wallpaper etc.
You may now do the following [[Things to do to tweak the install]]
!Full Install instructions Here:
http://docs.fedoraproject.org/en-US/Fedora/23/html/Installation_Guide/index.html
!!Error in anaconda effects 2f16 only
*https://bugzilla.redhat.com/show_bug.cgi?id=1269298
*https://github.com/rhinstaller/anaconda/pull/461/files
!!Script to fix it (must be run before the install)
To download a copy open a terminal and enter the following:
{{{wget http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/installToDisk/fix.sh}}}
Run it before launching the installer.
[[fix.sh]]
1KiB = 1024B
<nowiki>!= 1000</nowiki>
http://en.wikipedia.org/wiki/Kibibyte
See also MiB & GiB
Moodle has the same instructions
# Today you must show me your script from last week with regex and your sed commands with regex
# You will be filling in the network information form as it applies to your computer/group. You must do this for the computer on which you installed linux. @@This is due today@@
## The form to be filled out (neatly) and handed in will be given to you by the teacher, a copy is available on Moodle; //see Lab Week 11 Instructions folder//
## The instructions for filling out the form are on Moodle; See //see Lab Week 11 Instructions folder//
# You will [[Enable sshd]] in order to test the user/group lab components
# You will follow the instructions in the lab to manage users and groups on Moodle; See //see Lab Week 11 Instructions folder// Submit it to Léa.
/% Click [[here|https://docs.google.com/forms/d/1FbtIzYsa4TJSoq0VHwLebHD80WnCF71RtOj0q35tiv0/viewform]] to fill in information about your Linux box. (one per group svp) %/
See moodle for instructions, download this file:
http://sonic/~pcampbell/241/hosts.for.apache.lab
See moodle for instructions, update your hosts file, as you did last week, download this file:
http://sonic/~pcampbell/241/hosts.for.apache.lab
To replace your hosts file with the downloaded file
{{{
$ sudo su -
# cp /etc/hosts ~/hosts.$(date +%F)
# cp /home/<user who downloaded it>/Downloads/hosts.for.apache.lab /etc/hosts
}}}
>It is @@important@@ that you check your host name and ip address against the file, if it is incorrect let me know. If I can't get to your server because you have not told me about an error in the hosts file you will miss marks.
Preliminary iptables lab http://is.gd/mRnM1l
Code a script called dirchk.sh that displays data about a directory. The script should:
* Contain the 4 required statements
** interpreter designator
** your name
** date
** purpose of the script
* Have 1 command line argument, a directory.
* Have 1 local variable name, assign it your first name.
* Display a welcome message to the current logged on user (use an environment variable)
* If there is not 1 command line argument, display a message and exit the script.
* Test the command line argument, if it is not a directory, display a message and exit the script.
** bash file test operators http://tldp.org/LDP/abs/html/fto.html
* Display a count of the number of subdirectories of this directory.
** use a combination of ls and grep or find and grep or other
* Display a count of the number of files in the directory.
** use a combination of ls and grep or find and grep
* List all of the files in the directory that are zero length
** use an option of the find command to do this
* Use du to display the amount of storage space used by this directory
** check the man pages for du
* Display the name of the directory.
* Backup the contents of the directory using tar (with tar use bzip2 to compress the tarball.)
** create the tarball in /tmp
** the file name should be <nowiki>YYYY-MM-DD.tbz2</nowiki> (hint use date, look at %F and use command substitution)
** move the tarball into the directory
* Display a message using the local variable name: Brought to you by ...
Code this script one component at a time, test each component, then add the next.
It may be easiest to test this by creating a directory with a couple of directories, files and empty files, test with that.
Once all of the code is done test it with a another directory.
Make certain that your output is correct, the displayed output AND the tarball.
Using the script you created from [[Lab Script (week 5)]] or the teacher's solution from Moodle modify the code to do the following:
Your script will now use the command line argument if it exists, if it does not it will use instead a value read in:
#If there is a single command line argument use it and maintain existing behaviour
#If there are no command line arguments, ask the user to input a directory name
!!Note:
* for input validate the same way you did for command line argument
* for input do all of the same actions as command line argument
Today you are going to write some scripts to use the features of bash that you have learned.
Be sure to draw a flowchart before beginning.
!!One: if / then / elif /else
Using a command line argument, with the appropriate verification & error messages [ if there is a command line argument use it, if not error message and exit ]
If the command line argument is not a file give an appropriate error message and exit.
Using du and cut get the file size in bytes into a variable, using command substitution. //It is best to try the commands at the cli before using them in a script//
{{{
# this code is an exampleof using command substitution $() to assign a value to a variable filect
# get a count of the files in the current directory
filect=$(ls |wc -l)
echo There are $filect files in the current directory
}}}
If the file size is < 1KB display an appropriate message
else if the file size is < 1MB display an appropriate message
else if the file size is < 1GB display an appropriate message
else display an appropriate message
!!Two: while / until
Using the loop of your choice //(not for)// write a guessing game. Prompt the user to enter a letter of the alphabet. You decide which is the one to guess. If they enter the correct letter display an appropriate message and exit the loop.
Allow them to exit if they type letmego, no message.
Ensure that it is case insensitive.
!!Three: for
Expect the user to enter one or more command line argument. If there are none display an appropriate message.
Using command line arguments as your list and fto's within a for loop:
Check to see if it exists, if it does exist
if it is a file display an appropriate message
else if it is a directory display an appropriate message
else if it is a symbolic link display an appropriate message
Fancy: if it is a file, check to see if you are the owner and display info about the permissions (see file test operators http://tldp.org/LDP/abs/html/fto.html)
!!Four: case
Using the same idea as in Two create a guessing game, choose three letters that may be guessed.
Using the loop of your choice use either a compound condition or use another variable that can be set to indicate the loop is finished.
Inside the loop use a case statement, be sure to match on all 3 possible letters, upper and lower case.
{{{
while [ $bordercond != out ] do
case guess in
[aA] ) echo " you guessed right!"
bordercond=out
;;
* ) echo "try again"
;;
esac
done
}}}
Today you are going to write a script to use arithmetic and some simple functions
Note: bash can only do integer arithmetic, if you are interested see here for [[bash and floating point arithmetic]]
Be sure to draw a flowchart before beginning.
Hints: [[ arithmetic |http://linuxcommand.org/lc3_wss0100.php]]
!!Script example, use of simple functions and arithmetic [[addfunc.sh | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/addfunc.sh.txt]]
!! Script Phase 1
Write a script that will get 2 numbers from the user and as directed perform arithmetic (addition, subtraction, division or multiplication) on the numbers.
//@@As you develop this script do addition first, make sure it works then do the other arithmetic operations. __Incremental development!!__@@//
<hr>
@@color(red): NOTE: If you choose to use a return statement for your functions you are limited to 0-255 as return values, no negatives. If you use a total variable instead of return you will not have this problem.@@
<hr>
Write one function for each arithmetic operation. Each function will use 2 numbers. For the division
function, check for and do not divide by zero, return zero instead. Use integer numbers only. @@You have an example of a function that adds in the Script example link above@@
Ignore command line arguments. Prompt the user to enter 2 numbers, assume they are integers, do not do data validation. Prompt the user to select addition, subtraction, division or multiplication.
The prompts and values may take any form you wish: a, add, addition, A etc, you decide what is valid and check for it.
This is a form of menu, so a case statement would work best.
Depending on the arithmetic operation selected call a function that will perform the arithmetic and return results.
Display the results to the users along with the numbers they entered
!! Script Phase 2 (optional)
Once phase 1 is working put the code in a loop to continuously ask for numbers and arithmetic operations, if at any point they enter quit, exit the program.
!! Script Phase 3 (optional)
If 3 command line arguments are entered, check for an option -a (add), -s (subtract) etc. Perform the arithmetic, be sure to keep the code that reads from the user, use it if there are not sufficient command line arguments. For example:
{{{ ./myscript.sh -m 5 6 }}}
results in 30
{{{ ./myscript.sh -a 5 6 }}}
results in 11
!! Script Phase 4 (optional)
Include //modulus// and //power of// arithmetic operations in the interactive and the command line component
!! Script Phase 5 (optional)
Ensure that any arithmetic results are floating point
If you have not yet done so first complete the scripts in [[Lab Script (week 8)]] be sure you understand what you are doing.
@@The following is an assignment to be submitted see Léa for due date@@
!Script Using Functions
Write a script that when given command line arguments compares them and displays the largest and smallest.
Using a case statement or ifs check the number of command line arguments to call the appropriate function.
If the number of command line arguments is not 2,3, or 4 display an error message.
Display the smallest and largest values.
To do this write 3 functions comp2, comp3 and comp4 to compare 2, 3 and 4 arguments respectively.
!!!!comp2
# requires two arguments, returns an error code of 1 if there are not two arguments.
# compares the two arguments and puts the largest in a variable max, the smallest in a variable min.
!!!!comp3
# requires three arguments, returns an error code of 1 if there are not three arguments.
# compares the three arguments and puts the largest in a variable max, the smallest in a variable min.
!!!!comp4
# requires four arguments, returns an error code of 1 if there are not four arguments.
# compares the four arguments and puts the largest in a variable max, the smallest in a variable min. <br>You may want to use your other functions to do this.
!!Example of calling the function comp2
{{{
# call my function comp2, it compares two arguments.
comp2 6 999
# check the return code of the function
# if it is 0 then show the values set by the function $min and $max
if [ $? -eq 0 ] ; then
echo smallest argument is $min
echo largest argument is $max
fi
}}}
!References:
Use your course notes, Appendix A of your book and http://www.zytrax.com/tech/web/regex.htm
http://xkcd.org/208/
!Part 1
Write a script to prompt the user to enter a string, read it in then to match it to a series of regular expressions as follows (they are case sensitive):
# ends with: Linux
# begins with: Linux
# contains the string unix
# begins with an upper case letter
# does not contain a number (0-9) anywhere
# contains Windows or Linux or windows or linux
# contains thingg (with minimum 2 g maximum 5 g on the end)
# does not contain any whitespace
# contains Linux (with 0 or more x on the end)
# contains the word Tux (preceded and followed by blank)
n.b. for the //does not contain// you may need to play around with anchors
!Part 2
Using the same regular expressions as in Part 1 do the same match using sed.
Since it is sed, you can put all of your strings into a file and use the file as input to your sed commmands.
!!!using sed
{{{
# instruction inline locate string this and print it
# -n is silent (don't print as you scan, print only match
sed -n /this/p file
# instruction(s) in scriptfile
sed -nf scriptfile file
}}}
!!!sed basic versus extended regex
{{{
# sed defaults to using basic regex, some of the regex you have
# seen are extended regex, to force sed to understand them
# you must use the following syntax
sed -nr "/thing{2,3}/p " file
}}}
!Part 3 (Optional)
For those who are interested, I have a series of exercises using sed and gawk, ask me.
*Part 1
**USB must be formated FAT32 @@NOT NTFS@@
**//Smaller USBs work better <= 16GB && >= 4GB//
**You can skip the verification step since you are doing this in the lab, if you do it at home, verify the download
**download from the link
**you can do this in a group
**I recommend you use 2 computers 1 for instructions & install 1 for booting
**everyone must install to their own USB
**[[Install to USB | http://sonic.dawsoncollege.qc.ca/compsci/index.php/Install_to_Bootable_USB]]
*Part 2
**Once it is installed
**#be sure to boot it on a separate computer to ensure that it works
**#load a browser and some website
**#show it to the teacher to sign off on the lab
**#start working on the quiz [[quiz| https://drive.google.com/open?id=1mY4GzCYRMOLoFNxcJ9HN-0fN30TIA1GropT-tL56cKw]] (submit to save your answers, will be marked for attempt not for correct answers)
#[[Install to disk]]
#[[Things to do to tweak the install]] WHEN YOU DO THESE CONFIG CHANGES TEST THEM, THEY ARE NOT DONE UNTIL TESTED
#[[Report on the install | http://goo.gl/forms/MWnArwwzm9]]
*Part 1
**USB must be formated FAT32 @@NOT NTFS@@
**//Smaller USBs work better <= 16GB && >= 4GB//
**download from the link
**you can do this in a group BUT each of you must install to USB
**I recommend you use 2 computers 1 for instructions & install 1 for booting
**everyone must install to their own USB
**[[Install to USB | http://sonic.dawsoncollege.qc.ca/compsci/index.php/Install_to_Bootable_USB]]
*Part 2
**Once it is installed
**#be sure to boot it on a separate computer to ensure that it works
**#load a browser and some website
**#show it to the teacher to sign off on the lab
<html>
<head>
<title>
Lab Week 03 Install software
</title>
<h2>Chapter 13 (6th ed) Chapter 12 (7th ed) Downloading & Installing Software
</h2>
<h3>Preparation</h3>
Installation is an administrative task, you will need to use sudo either for each command or use sudo to switch user to root. <i>don't miss out the -</i>
@@colour;Use sudo, do not switch directly @@
<pre>
[a@b ~]$ sudo su -
</pre>
<pre>
[root@b ~]#
</pre>
<hr>
<h3>Install using a tarball</h3>
<a href=http://linuxstuff.tiddlyspot.com/#%5B%5BInstall%20Asciiaquarium%5D%5D/>
Install Ascii Aquarium
</a>
<hr>
<h3>Download and install an rpm, using the rpm utility</h3>
<a href=http://linuxstuff.tiddlyspot.com/#[[Install%20Webmin]]
>Install Webmin
</a>
<hr>
<h3>Install software using dnf</h3>
<i>Everywhere you see dnf if you are using Fedora 21 and lower use yum</i> When you use dnf (or yum) it searches all repositories configured for this computer. If it finds what you are looking for it will install it and the dependencies. There are some default repos which have some things we need (gnome-tweak-tool) and there are others we may want to use such as one for chrome and rpmfusion.
<ol>
<li>Install the rpm fusion repository, This repo contains software that RedHat doesn't want to deal with, so there may be some closed source maybe some other things we want. VLC is one of them, check the repo for others you may want to install:
<ol>
<li>Download the rpm for the rpmfusion free and non-free repositories : <br>
You may have installed one of these already (stable), but try them and see what happens.
<pre>
wget http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-23.noarch.rpm
wget http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-23.noarch.rpm
</pre>
<li>Install the rpms that will install the repositories: <br>
<pre>
dnf install rpmfusion-free-release-23.noarch.rpm
dnf install rpmfusion-nonfree-release-23.noarch.rpm
</pre>
<li>Install VLC VideoLan Media player (use the rpmfusion repositories)<br>say y to import the key
<pre>
dnf install vlc
dnf install mozilla-vlc
</pre>
</ol>
</ol>
</html>
!Set up the Chrome Repo and Install Chrome
http://www.if-not-true-then-false.com/2010/install-google-chrome-with-yum-on-fedora-red-hat-rhel/
!Using dnf install & run the following ex {{{dnf install oneko }}}
*oneko ( cat chases the cursor)
*xeyes, run it to illustrate foreground/background processes
*fortune-mod
*cowsay
*choose an alternate terminal emulator: http://www.tecmint.com/linux-terminal-emulators/ I like terminator
*Extras
**java
**filezilla
**gimp
**inkscape
**p7zip
**VirtualBox
!Install an alternate desktop environment
*[[Install Alternate DE]]
!Set up and test access to your H: drive, you can backup any changes there in future.
*[[Mount H: drive on linux]]
!Optional, install Dropbox
*[[Install Dropbox]]
@@color:red; //DO NOT START// UNTIL I GIVE THE OK, WE ARE SHARING THIS LAB WE DO NOT WANT TO CLOBBER OR BE CLOBBERED@@
Note there are three, count em, three steps in this lab, you are not finished until you have done all three steps. I will be testing your install.
Everyone must install but you can do this in discussion with each other.
Before: use BIOS to disable everything but HDD1 (forces Install to HDD1)
#[[Install to disk]]
#[[Things to do to tweak the install]] WHEN YOU DO THESE CONFIG CHANGES TEST THEM, THEY ARE NOT DONE UNTIL TESTED
#[[Report on the install | http://goo.gl/forms/MWnArwwzm9]]
After: use BIOS to enable everything all HDD1 reboot, should default to windows
<html>
<head>
<title>
Lab Week 03 Install software
</title>
<h2>Chapter 13 (6th ed) Chapter 12 (7th ed) Downloading & Installing Software
</h2>
<h3>Preparation</h3>
Installation is an administrative task, you will need to use sudo either for each command or use sudo to switch user to root. <i>don't miss out the -</i>
@@colour;Use sudo, do not switch directly @@
<pre>
[a@b ~]$ sudo su -
</pre>
<pre>
[root@b ~]#
</pre>
<hr>
<h3>Install using a tarball</h3>
<a href=http://linuxstuff.tiddlyspot.com/#%5B%5BInstall%20Asciiaquarium%5D%5D/>
Install Ascii Aquarium
</a>
<hr>
<h3>Download and install an rpm, using the rpm utility</h3>
<a href=http://linuxstuff.tiddlyspot.com/#[[Install%20Webmin]]
>Install Webmin
</a>
<hr>
<h3>Install software using dnf</h3>
<i>Everywhere you see dnf if you are using Fedora 21 and lower use yum</i> When you use dnf (or yum) it searches all repositories configured for this computer. If it finds what you are looking for it will install it and the dependencies. There are some default repos which have some things we need (gnome-tweak-tool) and there are others we may want to use such as one for chrome and rpmfusion.
<ol>
<li>Install the rpm fusion repository, This repo contains software that RedHat doesn't want to deal with, so there may be some closed source maybe some other things we want. VLC is one of them, check the repo for others you may want to install:
<ol>
<li>Download the rpm for the rpmfusion free and non-free repositories : <br>
You may have installed one of these already (stable), but try them and see what happens.
<pre>
wget http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-23.noarch.rpm
wget http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-23.noarch.rpm
</pre>
<li>Install the rpms that will install the repositories: <br>
<pre>
dnf install rpmfusion-free-release-23.noarch.rpm
dnf install rpmfusion-nonfree-release-23.noarch.rpm
</pre>
<li>Install VLC VideoLan Media player (use the rpmfusion repositories)<br>say y to import the key
<pre>
dnf install vlc
dnf install mozilla-vlc
</pre>
</ol>
</ol>
</html>
!Set up the Chrome Repo and Install Chrome
http://www.if-not-true-then-false.com/2010/install-google-chrome-with-yum-on-fedora-red-hat-rhel/
!Using dnf install & run the following ex {{{dnf install oneko }}}
*oneko ( cat chases the cursor)
*xeyes, run it to illustrate foreground/background processes
*fortune-mod
*cowsay
*choose an alternate terminal emulator: http://www.tecmint.com/linux-terminal-emulators/ I like terminator
*Extras
**java
**filezilla
**gimp
**inkscape
**p7zip
**VirtualBox
!Install an alternate desktop environment
*[[Install Alternate DE]]
!Set up and test access to your H: drive, you can backup any changes there in future.
*[[Mount H: drive on linux]]
!Optional, install Dropbox
*[[Install Dropbox]]
@@make a directory lab4, move all of last weeks scripts in there@@
@@make a directory lab5, create and test all of //this// weeks scripts in there@@
I will be checking your script(s) from last week, please let me know which userid you have been using, I have a signup sheet at the front of the lab.
Today you are going to write some scripts to use the features of bash that you have learned. (for, while/until, here document, case/switch, arithmetic)
They are short but be sure to draw a flowchart before beginning so you have a plan.
!!You may want to use the following for reference
*Advanced BASH scripting guide http://tldp.org/LDP/abs/html/index.html
*File test operators http://tldp.org/LDP/abs/html/fto.html
*Arithmetic operators http://tldp.org/LDP/abs/html/ops.html
*Arithmetic //operations// http://tldp.org/LDP/abs/html/arithexp.html
Next week:
*Functions http://www.tldp.org/LDP/abs/html/functions.html
!There are five scripts to be done here:
!!One: if / then / elif /else / loop / arithmetic
Example execution {{{ ./one.sh file1 file2.txt /etc/ }}}
You will use the command line argument as a list, with the appropriate verification & error messages [ if there are no command line args error message and exit ]
Using a for loop go through all command line arguments:
If the argument is not a file display an appropriate error message
otherwise
display the file name and the file size in bytes and in KiB ,
*(Get the size using using command substitution (hint: use du with cut, look at the man pages for bytes))
*divide by 1024 to get KiB
//It is best to try the commands at the cli before using them in a script// if you can't remember how see here [[bash command substitution]]
!!Two: while / until, read / arithmetic
{{{./two.sh}}}
Ignore command line arguments.
Using the loop of your choice //(not for)// write a guessing game.
Assign a variable your hidden letter, to be guessed.
Prompt the user to enter a letter of the alphabet. If they enter the correct letter display an appropriate message and the guess counter and exit the loop.
Add 1 to a counter for each iteration of the loop
If they enter hint display a hint ex: "between A and F"
Ensure that it is case insensitive so if your secret letter is a, then A or a would be correct.
Optional: Install banner, when they guess successfully clear the screen and use banner to show a message ex You Win! plus the counter.
!!Three: create a menu using a case statement
{{{ ./three.sh }}}
This script is to display a count of either files, directories or symbolic links in a given directory, it will run in a loop until the user enters Q/q.
Prompt the user to enter F/f, D/d, S/s or Q/q/quit
Create a menu using case, the options are D/d, F/f, S/s, Q/q/quit and default
If they select D/d - display "Showing directores"
If they select F/f - will display "Showing files"
If they select S/s - will display "Showing symlinks"
If they select Q/q/quit - will display "Are you sure you want to quit? " read in the response, if the answer is y or yes then display "Quitting"
Default will show an appropriate message asking them to try again.
!!!Once it is working
Put it into a loop which ends when the response == Q
!!!Once it is working modify it as follows
#If they select D/d - display "Showing directores" then use a for loop to go through the files in the current directory (ls), if they are directories display the name
#If they select F/f - will display "Showing files" then use a for loop to go through the files in the current directory (ls), if they are files display the name
#If they select S/s - will display "Showing symlinks" then use a for loop to go through the files in the current directory (ls), if they are symlinks display the name
!!Four: while/until / arithmetic
{{{ ./four.sh }}}
The script is to ask the user to input numbers, it will keep a running sum of the numbers and keep a running count of the numbers as they are input.
Stop summing when a sentinel of -1 is entered.
When the sentinel is input, display the sum, the count and the average of the numbers entered.
!!Five: for loop
{{{ ./five.sh }}}
Using the date command make a directory of today's date plus the pid of the current process (special variable): 2016-02-20.2341
for each command line arguments create a sub directory in the date+pid directory.
Loop through the command line arguments (there is a special variable for this, remember?)
!!Optional Challenge: if / then / elif /else, for, here document, arithmetic
Expect 2 command line argument, with the appropriate verification & error messages [ if there are 2 command line arguments OK, if not error message and exit ]
./setup.sh <classname> <classlist.txt>
Of the two arguments one must be the name of the class and the other is a file containing student names. Make sure that one argument is a file, use that argument as the list of student names. The other is a class name to be used as a directory.
If the directory exists display an error message and exit.
Make a new directory using the class name.
Within that directory create a directory for each student name in the file. Keep a count as you go through the entries.
In each student directory create a file welcome.txt using a here document, all of the entries in <> must be stubstituted:
{{{
Hello <student name>,
There are <total count> students in the class you are number <counter>
Welcome to the best course at Dawson College: <classname>.
You will learn a lot!
Sincerely, your teacher,
<yourname>
}}}
Check if the student has an account on this computer. If they do not have an account append an error message "no userid here for <student name> to a log file named <scriptname>.log
Hint: Use grep and /etc/passwd, check the return/status code of grep
Scripting lab 1/ (command line args, arithmetic & string comparison operantors, file test operators, read built in)
@@make a directory lab5, create and test all of //this// weeks scripts in there@@
@@backup your files to the H: drive on /mnt/H<yourid>@@
@@or backup your files to sonic:
{{{
scp myscript.sh <youruserid>@sonic.dawsoncollege.qc.ca:~/
}}}
!This lab is intended as practice for writing scripts. You should use some old concepts and some new concepts. I will check your systems for last weeks labs and spot check current work on this lab. DO NOT not shutdown without telling me.
Use VI for all of these scripts, see Using VIM for practice
Use the Quick Reference [[pdf on moodle | http://sonic.dawsoncollege.qc.ca/~pcampbell/aec2.dawsoncollege.qc.ca/linux/intro2011/25-bash-scripting-data-conditions-Ch27/bash-scripting-ref.pdf]]
Read through the relevant [[bash sample scripts|https://github.com/campbe13/ScriptsSamples241]]
''n.b All scripts must start with the 4 required statements''
* interpreter designator
* your name
* date
* purpose of the script
@@You are using command line arguments, local variables, environment variables, if statements, file test operators, command substitution, tar and some other commands@@
!!1. script1.sh Write a script to display the following precede each with the name of the script
*The logged on user name (use an environment variable)
*The current working directory (use command substitution $(command)
*The name of the shell (use an environment variable)
*The name of the operating system (use uname and command substitution, see the man pages
*A listing of all files in the /etc/ directory that end in conf (use ls or find)
example:
display.sh: tricia
display.sh: /home/tricia
display.sh: bash
display.sh: GNU/Linux
//files ending in conf//
for the environment variables use {{{set|less}}} to see what's there
!!2. script2.sh Using command line arguments & arithmetic comparison operators
*Ensure that there are 2 command line arguments, if not show an error message and end
*test it with strings, what happens?
*Do not do data validation
*compare the variables, display the largest and the smallest
!!3. script3.sh Using command line arguments & arithmetic comparison operators
Expand on the last script:
*Modify it to use 3 command line arguments
*Display largest, smallest and middle.
!!4. script4.sh Using the read builtin & arithmetic comparison operators
Change the last script:
*Modify it to ignore command line arguments and read into & use three variables instead
!!5. script5.sh Using the read builtin & string comparison operators
*Using a variable, assign it a string containing your favourite colour ex: {{{mycolour=fuschia}}}
*Ask the user to enter their favourite colour.
*Compare the two, if they are the same display a message "Our favourite colour is //the colour//"
*If they are different display a message "My colour is //the colour// your colour is //the colour//""
!!6. script6.sh Using the read builtin & command line arguments & string comparison operators
*Change the last script to use a command line argument. If there is a command line argument use it, if there are none, ask for input and use that.
**hint use a new variable for both
!!7. script7.sh Using command line arguments & file test operators
*check for a command line argument, display a usage message and exit if there is none
*using file test operators:
** if the argument contains a file, display the name and "this is a file" then check if it is empty, display empty, or full
** if the argument contains a directory, display the name and "this is a dir" then check if it is executable display cd permission, or no cd permission
!!8. script8.sh Write a script to check for a user in the password file
*Ask the user to enter a userid
*use grep to determine if it is in the /etc/passwd file, look at the man pages, you may want to use a count
**assign the output of the command using command substitution to a variable ct
*If the value of ct is >= 1 then display a message saying the userid exists, if not say it doesn't exist/
!!9. script9.sh Write a script to display a greeting depending upon the time of day
*Look at the man page for date, discover how to display only the hour using format controls
*Using command substitution assign the output of the date hour to a variable hour
*If the hour is < 12 display good morning
*If the hour is > 12 and < 17 display good afternoon
*If the hour is > 18 display good evening
Scripting lab 2/ (while, until, arithmetic, if/else if)
@@make a directory lab6, create and test all of //this// weeks scripts in there@@
@@copy all scripts to your H: drive for backup it is mounted on /mnt/H<your id>@@
I will be checking your script(s) from last week, please let me know which userid you have been using, I have a signup sheet at the front of the lab.
Today you are going to write some scripts to use the features of bash that you have learned. (for, while/until, here document, case/switch, arithmetic)
They are short but be sure to draw a flowchart before beginning so you have a plan.
!!You may want to use the following for reference
*Advanced BASH scripting guide http://tldp.org/LDP/abs/html/index.html
*File test operators http://tldp.org/LDP/abs/html/fto.html
*Arithmetic operators http://tldp.org/LDP/abs/html/ops.html
*Arithmetic //operations// http://tldp.org/LDP/abs/html/arithexp.html
Next week:
*Functions http://www.tldp.org/LDP/abs/html/functions.html
!There are five scripts to be done here:
!!One: if / then / elif /else / loop / arithmetic
Example execution {{{ ./one.sh file1 file2.txt /etc/ }}}
You will use the command line argument as a list, with the appropriate verification & error messages [ if there are no command line args error message and exit ]
Using a for loop go through all command line arguments:
If the argument is not a file display an appropriate error message
otherwise
display the file name and the file size in bytes and in KiB ,
*(Get the size using using command substitution (hint: use du with cut, look at the man pages for bytes))
*divide by 1024 to get KiB
//It is best to try the commands at the cli before using them in a script// if you can't remember how see here [[bash command substitution]]
!!Two: while / until, read / arithmetic
{{{./two.sh}}}
Ignore command line arguments.
Using the loop of your choice //(not for)// write a guessing game.
Assign a variable your hidden letter, to be guessed.
Prompt the user to enter a letter of the alphabet. If they enter the correct letter display an appropriate message and the guess counter and exit the loop.
Add 1 to a counter for each iteration of the loop
If they enter hint display a hint ex: "between A and F"
Ensure that it is case insensitive so if your secret letter is a, then A or a would be correct.
Optional: Install banner, when they guess successfully clear the screen and use banner to show a message ex You Win! plus the counter.
!!Three: create a menu using a case statement
{{{ ./three.sh }}}
This script is to display a count of either files, directories or symbolic links in a given directory, it will run in a loop until the user enters Q/q.
Prompt the user to enter F/f, D/d, S/s or Q/q/quit
Create a menu using case, the options are D/d, F/f, S/s, Q/q/quit and default
If they select D/d - display "Showing directores"
If they select F/f - will display "Showing files"
If they select S/s - will display "Showing symlinks"
If they select Q/q/quit - will display "Are you sure you want to quit? " read in the response, if the answer is y or yes then display "Quitting"
Default will show an appropriate message asking them to try again.
!!!Once it is working
Put it into a loop which ends when the response == Q
!!!Once it is working modify it as follows
#If they select D/d - display "Showing directores" then use a for loop to go through the files in the current directory (ls), if they are directories display the name
#If they select F/f - will display "Showing files" then use a for loop to go through the files in the current directory (ls), if they are files display the name
#If they select S/s - will display "Showing symlinks" then use a for loop to go through the files in the current directory (ls), if they are symlinks display the name
!!Four: while/until / arithmetic
{{{ ./four.sh }}}
The script is to ask the user to input numbers, it will keep a running sum of the numbers and keep a running count of the numbers as they are input.
Stop summing when a sentinel of -1 is entered.
When the sentinel is input, display the sum, the count and the average of the numbers entered.
!!Five: for loop
{{{ ./five.sh }}}
Using the date command make a directory of today's date plus the pid of the current process (special variable): 2016-02-20.2341
for each command line arguments create a sub directory in the date+pid directory.
Loop through the command line arguments (there is a special variable for this, remember?)
!!Optional Challenge: if / then / elif /else, for, here document, arithmetic
Expect 2 command line argument, with the appropriate verification & error messages [ if there are 2 command line arguments OK, if not error message and exit ]
./setup.sh <classname> <classlist.txt>
Of the two arguments one must be the name of the class and the other is a file containing student names. Make sure that one argument is a file, use that argument as the list of student names. The other is a class name to be used as a directory.
If the directory exists display an error message and exit.
Make a new directory using the class name.
Within that directory create a directory for each student name in the file. Keep a count as you go through the entries.
In each student directory create a file welcome.txt using a here document, all of the entries in <> must be stubstituted:
{{{
Hello <student name>,
There are <total count> students in the class you are number <counter>
Welcome to the best course at Dawson College: <classname>.
You will learn a lot!
Sincerely, your teacher,
<yourname>
}}}
Check if the student has an account on this computer. If they do not have an account append an error message "no userid here for <student name> to a log file named <scriptname>.log
Hint: Use grep and /etc/passwd, check the return/status code of grep
!! First complete scripts from [[Lab Week 06 2016 Scripting - functions]] in directory lab6
!! Next a few regex in bash exercises in directory lab7
For reference see [[regex sed ref]] or just my [[Quick Ref | http://bit.ly/regex2014]]
!!!xkcd on regex
*http://xkcd.org/208/
*http://xkcd.org/1313/
*http://xkcd.org/1171/
*http://xkcd.org/1031/
Write a script to prompt the user to enter a string which you will then match to a series of regular expressions. You will have to use ifs because the case statement does only globbing. Do not nest the ifs, you will want one test after the other.
//Advice: Do incremental dev, implement the first one, make sure it works, then add the next one. Backup your scripts.//
You may want to put this in a loop and check for quit (any case) to end it, this would be a regex too.
For each regex display what you are testing (& the regex) and then a match/no match ex:
{{{
lab7.sh
ends in Linux
No match
begins with Linux
Match
}}}
The idea is that you will test the input string against all of the following:
# ends with: Linux
# begins with: Linux
# contains the string unix
#*contains the string unix any mixed case
# begins with an upper case letter
# does not contain a number (0-9) anywhere
# contains Windows or Linux or windows or linux
# contains thingg (with minimum 2 g maximum 5 g on the end)
# does not contain any whitespace
# contains Linux (with 0 or more x on the end)
# contains the word Tux (preceded and followed by blank)
# contains: any word that ends in nix
n.b. for the //does not contain// you may need to play around with anchors and try a few things
!TESTING
Here are some lists you can test against [[regex test lists]]
!Challenge A (optional)
If you want a further challenge you can read in the list using while [[read file with while]]
!Challenge B (optional)
How would you do this if you were checking against a sentence typed in at the command line as cli args?
Scripting lab 3/ (functions)
@@make a directory lab7, create and test all of //this// weeks scripts in there@@
@@backup your files to sonicethe H: drive on /mnt/H<yourid>@@
@@backup your files to sonic using {{{scp from to }}} @@
!!You may want to use the following for reference
*Advanced BASH scripting guide http://tldp.org/LDP/abs/html/index.html
*Arithmetic operators http://tldp.org/LDP/abs/html/ops.html
*Arithmetic //operations// http://tldp.org/LDP/abs/html/arithexp.html
*Functions http://www.tldp.org/LDP/abs/html/functions.html
Today you are going to write a script to use arithmetic and some simple functions
Note: bash can only do integer arithmetic, if you are interested see here for [[bash and floating point arithmetic]]
Be sure to draw a flowchart before beginning.
Hints: [[ arithmetic |http://linuxcommand.org/lc3_wss0100.php]]
Write a function named //summer// that will sum all of its arguments and assign the sum to a variable sum.
If there are no arguments return 5.
Write a function named //factorial// that will produce the factorial value of its single argument and assign the sum to a variable fac.
If there are no arguments return 5.
{{{factorial: 5! = 5*4*3*2*1 3! = 3*2*1}}}
Write a script to drive the functions, and use the global variables to display the results.
test it with 3-4 command line arguments (numbers), test it with numbers and strings.
!! sed using regex
For reference see [[regex sed ref]]
Using the same regular expressions as in [[ Lab Week 07 2016 Scripting - regex & functions]] do the same match using sed.
Since it is sed, you can put all of your strings into a file and use the file as input to your sed commmands. Use the same [[regex test lists]] put it into a file.
!!Instructions for using sed http://wiki.pcampbell.profweb.ca/index.php/Sed
!!tl;dr Instructions for using sed
{{{
# instruction inline locate string this and print it
# -n is silent (don't print as you scan, print only match
sed -n /this/p file
# instruction(s) in scriptfile
sed -nf scriptfile file
}}}
!!!sed basic versus extended regex
{{{
# sed defaults to using basic regex, some of the regex you have
# seen are extended regex, to force sed to understand them
# you must use the following syntax (-r)
sed -nr "/thing{2,3}/p " file
}}}
!! Create a directory lab7
For reference see [[regex sed ref]] or just my [[Quick Ref | http://bit.ly/regex2014]]
!!!xkcd on regex
*http://xkcd.org/208/
*http://xkcd.org/1313/
*http://xkcd.org/1171/
*http://xkcd.org/1031/
Write a script to prompt the user to enter a string which you will then match to a series of regular expressions. You will have to use ifs because the case statement does only globbing. Do not nest the ifs, you will want one test after the other.
//Advice: Do incremental dev, implement the first one, make sure it works, then add the next one. Backup your scripts.//
You may want to put this in a loop and check for quit (any case) to end it, this would be a regex too.
For each regex display what you are testing (& the regex) and then a match/no match ex:
{{{
lab7.sh
ends in Linux
No match
begins with Linux
Match
}}}
The idea is that you will test the input string against all of the following:
# ends with: Linux
# begins with: Linux
# contains the string unix
#*contains the string unix any mixed case
# begins with an upper case letter
# does not contain a number (0-9) anywhere
# contains Windows or Linux or windows or linux
# contains thingg (with minimum 2 g maximum 5 g on the end)
# does not contain any whitespace
# contains Linux (with 0 or more x on the end)
# contains the word Tux (preceded and followed by blank)
# contains: any word that ends in nix
n.b. for the //does not contain// you may need to play around with anchors and try a few things
!TESTING
Here are some lists you can test against [[regex test lists]]
!Challenge A (optional)
If you want a further challenge you can read in the list using while [[read file with while]]
!Challenge B (optional)
How would you do this if you were checking against a sentence typed in at the command line as cli args?
!Part 1
Open a terminal, maximize it and paste in the following
{{{
curl -s -L http://bit.ly/10hA8iC | bash
}}}
If you have not yet done so complete and submit [[Lab Week 08 2016 Using sed]] //(you may want to do Part 2 first as it must be done in the lab, it cannot be done on sonic nor at home.) //
!Part 2
Submit to Lea and give me a printed copy. You may do this in teams of two, each of you boot your Linux boxes: work on one box, test with the other.
Follow the instructions [[ here | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/useradmin/]] You will be creating users with their own home directories and configuring a shared group and directory.
//NOTE Teams of 2 max, submit to Lea and give me a printed copy. //
!! sed using regex
For reference see [[regex sed ref]]
Using the same regular expressions as in [[ Lab Week 07 2016 Scripting - regex & functions]] do the same match using sed.
Since it is sed, you can put all of your strings into a file and use the file as input to your sed commmands. Use the same [[regex test lists]] put it into a file.
!!Instructions for using sed http://wiki.pcampbell.profweb.ca/index.php/Sed
!!tl;dr Instructions for using sed
{{{
# instruction inline locate string this and print it
# -n is silent (don't print as you scan, print only match
sed -n /this/p file
# instruction(s) in scriptfile
sed -nf scriptfile file
}}}
!!!sed basic versus extended regex
{{{
# sed defaults to using basic regex, some of the regex you have
# seen are extended regex, to force sed to understand them
# you must use the following syntax (-r)
sed -nr "/thing{2,3}/p " file
}}}
!Part 1
Open a terminal, maximize it and paste in the following
{{{
curl -kL http://bit.ly/1HieDCL |bash
}}}
!Part 2 using regex with sed
For reference see [[regex sed ref]]
Using the same regular expressions as in [[Lab Week 9 2015]] do the same match using sed.
Since it is sed, you can put all of your strings into a file and use the file as input to your sed commmands. Use the same [[regex test lists]] put it into a file.
!!Instructions for using sed http://wiki.pcampbell.profweb.ca/index.php/Sed
!!tl;dr Instructions for using sed
{{{
# instruction inline locate string this and print it
# -n is silent (don't print as you scan, print only match
sed -n /this/p file
# instruction(s) in scriptfile
sed -nf scriptfile file
}}}
!!!sed basic versus extended regex
{{{
# sed defaults to using basic regex, some of the regex you have
# seen are extended regex, to force sed to understand them
# you must use the following syntax (-r)
sed -nr "/thing{2,3}/p " file
}}}
!Part 3 User Administration
Follow the instructions [[ here | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/useradmin-lab.docx]] You will be creating users with a shared group and directory. NOTE Teams of 2 max, submit to Lea.
!1 Network Configuration
The first part is looking at your network configuration through the instructions in this pdf [[net config |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/netconfig/241-network-config-instructions.pdf ]] as you go through it you will be able to fill out the form.
The form can found here in pdf format [[ form | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/netconfig/241-network-configuration-form.pdf ]] which you will want to download PRINT and fill in. You will have to hand this in to me so print it and fill it in by hand. Write the answers to the exercise on the back of the form.
>Note some things must be done as root, not as a regular user, but do not do regular tasks as root
>Note: 16. netcat no longer has the -z option so you may play with it using port 80 and the -v option, it was meant to do port scanning so if you are adventurous install nmap (use dnf) and run it ex: {{{nmap -sS -O www.dawsoncollege.qc.ca }}}
>Note, interface name: (ifconfig shows all active interfaces)
>> 2f.16 lab has interface enp0s25 NOT p128p1
>> 2f.18 lab has interface en0x NOT p128p1
>> do not use loopback lo
>> do not use virtual interface vibr
>Note if you don't understand something this is where you can google it for clarification.
!!2 hosts file
Download the hosts file from [[here |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/netconfig/hosts]]. Replace your /etc/hosts file with the downloaded file.
Once it is in place test it by pinging your neighbours computer by name
!Part 1
Open a terminal, maximize it and paste in the following
{{{
curl -s -L http://bit.ly/10hA8iC | bash
}}}
!Part 2
For this lab you will give me a neat, printed copy due in 1 week. This is best done in teams of two, each of you boot to your LInux box, the work done on one box, test with the other.
Follow the instructions [[here| https://drive.google.com/open?id=0B-CHlg81QPjfQjFSVnZXcTZZRHc]] You will be creating users with a shared group and directory.
NOTE Teams of 2 max, you will give me a printed copy before or during the next lab.
!Part 1 (do this solo on your own Linux box)
!!1.1 Network Configuration
The first part is looking at your network configuration through the instructions in this pdf [[net config |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/netconfig/241-network-config-instructions.pdf ]] as you go through it you will be able to fill out the form found here in pdf format [[ form | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/netconfig/241-network-configuration-form.pdf ]] which you will want to download and fill in. You will have to hand this in to me so print it and fill it in by hand. Write the answers to the exercise on the back of the form.
>Note: 16. netcat no longer has the -z option so you may play with it using port 80 and the -v option, it was meant to do port scanning so if you are adventurous install nmap (use yum) and run it ex: {{{nmap -sS -O www.dawsoncollege.qc.ca }}}
>Note: 2f.14 lab has interface enp2s0 NOT p128p1
!!1.2 hosts file
Download the hosts file from [[here |https://drive.google.com/file/d/0B-CHlg81QPjfTURrd0dpZ3ZJd00/view?usp=sharing]]. Replace your /etc/hosts file with the downloaded file. :
Once it is in place test it by pinging your neighbours computer by name
>It is @@important@@ that you check your host name and ip address against the file, if it is incorrect let me know. If I can't get to your server because you have not told me about an error in the hosts file you will miss marks.
!Part 2 (do this with your team of two on one of your computers)
@@Please read the instructions below before downloading the files AND read the files when you do download them.@@
Today we will start to configure network services. You must do this with your team on your Linux install in the lab.
You will be doing this configuration and others over the next few weeks, until the end of term. I will check your progress every week. This week you will start your Administrator's log and configure Apache. Be sure to back up any configuration files you use (copy them to a USB or other, or email them to yourselves) If you lose configuration you may have to use your admin log to recreate it, so be thorough in your writing.
!Part 2 Instructions
!!2.1 Administrators Log
You will keep an administrators log of what is done to your server, when it is done and by whom. A sample is given named 241-sampleAdminSystemLog.ods (libre office spreadsheet.) Download a copy and keep your team file on USB or google doc or dropbbox do not loose it as it is a component of your mark. //If it is not a shared doc @@EMAIL IT TO EACH TEAM MEMBER AT THE END OF THE LAB@@// You will get 0 if you loose this document and it is meant to be a log of actions for this and the next few labs.
The sample may be found [[here | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/adminlog/]]
!!2.2 Configure Apache
This week follow the instructions in the apache lab document which may be found [[ here | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/apache/]]
!!MARKING:
Keep your log available during lab classes as I will ask to see it from time to time. At the end of term you will be submitting your log. However during the next few weeks I will be checking your live system for your configuration and access to your services.
!!Advanced, optional
* Install and run awstats http://www.server-world.info/en/note?os=Fedora_20&p=httpd&f=11
@@color(orange):READ EVERYTHING IN THIS SECTION BEFORE YOU START@@
!Server config Apache
You are now beginning to set up the server. You will be adding components to your server each week until the end of term. These labs follow each other and are interconnected. This work must be done on the same computer (one of the group) each week.
Decide on one computer to be the server (same each week) and use another for reading the lab, and checking instruction & google.
@@ If you are not able to attend a lab you do not get marks for the work done during that lab.@@
Teams of 2 MAX you will let me know, today:
1 your team members
2 the IP address of the computer you are using
3 the hostname of the computer you are using. (it must be pingable, so must be in the hosts file, test this )
!!1 Administrators Log
You will keep an administrators log of what is done to your server, when it is done and by whom. A sample is given named 241-sampleAdminSystemLog.ods (libre office spreadsheet.) Download a copy and keep your team file as a shared file on Google Docs. If you do not have a google email id you will have to get one.
Make sure each team member and I have access (pcampbell.edu@gmail.com) do not loose it as it is a component of your mark. //If it is not a shared doc @@EMAIL IT TO EACH TEAM MEMBER AT THE END OF THE LAB@@// You will get 0 if you loose this document and it is meant to be a log of actions for this and the next few labs.
Full instructions here [[Admin Log for Networking labs]]
!!2 Backup
Any config files you change copy them to a USB, your H: drive or email them to yourself, if you loose the box for some reason you will have to redo the work, if you have the config files this will be much less painful.
!!3 Configure pache
This week use your book Chapter 26 and follow the instructions in the apache lab document which may be found [[ here | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/apache/]]
!!Team info, give it to me during the lab, write clearly on a piece of paper:
1 your team members
2 the IP address of the computer you are using
3 the hostname of the computer you are using.
!!MARKING:
Each week I will spot check your system, boot it at the beginning of every lab. Keep your log accessible during lab classes as I will ask to see it from time to time. At the end of term one of the team members will be submitting your log.
I will be checking your live system for your configuration and access to your services each week.
!!Advanced, optional
* Install and run awstats http://www.server-world.info/en/note?os=Fedora_20&p=httpd&f=11
!1 Network Configuration
The first part is looking at your network configuration through the instructions in this [[net config |https://docs.google.com/document/d/1H0PfkFAo9DolB74EYMBcCqlN5sG3LLWbMTIj6jLRyRU/edit?usp=sharing ]] as you go through it you will be able to fill out the form.
The form can found here [[ form | https://docs.google.com/document/d/1WegzYHeWfU2gVRM55HMU1xatByB57YmrJhseJn9Kuug/edit?usp=sharing ]] which you will want to download PRINT and fill in. You will have to hand this in to me so print it and fill it in by hand. Write the answers to the exercise on the back of the form.
>Note some things must be done as root, not as a regular user, but do not do regular tasks as root
>Note: 16. netcat no longer has the -z option so you may play with it using port 80 and the -v option, it was meant to do port scanning so if you are adventurous install nmap (use dnf) and run it ex: {{{nmap -sS -O www.dawsoncollege.qc.ca }}}
>Note, interface name: (ifconfig shows all active interfaces)
>> 2f.16 lab has interface enp0s25 NOT p128p1
>> do not use loopback lo
>> do not use virtual interface vibr
>Note if you don't understand something this is where you can google it for clarification.
!!2 hosts file
Download the hosts file from [[here |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/netconfig/hosts]]. Replace your /etc/hosts file with the downloaded file.
Once it is in place test it by pinging your neighbours computer by name
!!3 Optional
Create your own [[mini web server]]
If you have not yet done so, complete last weeks lab. Create a soft link named index.html to myfile.html
Group work, same group and server as last week, instructions here [[vhosts lab |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/vhostslab/ ]]
Continue to update your Administrators log with what is done today, share the document either via a service or via email (marks, remember?).
>You will see in the instructions you must have 3 valid, non-duplicated, //ping able// names in the hosts file associated with the IP address of the host you are working on in order to do this lab. I have changed some, please download the hosts.txt file and replace it again. If you still do not have 3 or the IP address has changed then change it to be sure you do and let me know. If you do have 3 valid //ping able// names do not change them because you don't like them. I use this information to mark your lab, don't forget to let me know.
!!MARKING:
Keep your log available during lab classes as I will ask to see it from time to time. At the end of term you will be submitting your log. However during the next few weeks I will be checking your live system for your configuration and access to your services.
I will be checking last weeks lab. Test
Group work, same group and server as last week
!!First verify remote access
You may not have permanently updated your firewall, test your server from a remote box and make sure httpd is up & accessible. If I can't load it you don't get marks. ( if you can't load it go back to the book ...)
!!Second do this week's lab Virtual Hosts
Instructions here [[vhosts lab |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/vhostslab/ ]]
Once you have selected and pinged your 3 host names, come and write them down for me (reed the instructions to understand this statement.)
@@Continue to update your Administrators log with what is done today. I will be giving 25% of the mark for the admin log every week from here on so update it as you do the work. Make sure I can comment on it and make sure everyone in the group can update it.@@
>You will see in the instructions you must have 3 valid, non-duplicated, //ping able// names in the hosts file associated with the IP address of the host you are working on in order to do this lab. If you do not have 3 or the IP address has changed then change it to be sure you do @@and let me know.@@ If you do have 3 valid //ping able// names do not change them because you don't like them. I use this information to mark your lab, don't forget to let me know.
!!MARKING:
Today I will be testing last week's lab. Next week I will test this lab.
I want to see the group using one computer with the admin log being updated while you work on the server on another.
@@color(orange):READ EVERYTHING IN THIS SECTION & the Admin log link BEFORE YOU START@@
@@color(orange):READ EVERYTHING IN THIS SECTION & the Admin log link BEFORE YOU START@@
@@color(orange):READ EVERYTHING IN THIS SECTION & the Admin log link BEFORE YOU START@@
!Server config Apache
You are now beginning to set up the server. You will be adding components to your server each week until the end of term. These labs follow each other and are interconnected. This work must be done on the same computer (one of the group) each week.
Decide on one computer to be the server (same each week) and use another for reading the lab, and checking instruction & google.
@@ If you are not able to attend a lab you do not get marks for the work done during that lab.@@
Teams of 2 MAX you will let me know, today:
1 your team members
2 the IP address of the computer you are using
3 the hostname of the computer you are using. (it must be pingable, so must be in the hosts file, test this )
!!1 Administrators Log
You will keep an administrators log of what is done to your server, when it is done and by whom. A sample is given via the link below. You must keep it as a shared file on Google Docs. If you do not have a google email id you will have to create one. Make a copy of the file on your Google Drive and share it with read write access for each team member and me(pcampbell.edu@gmail.com) do not loose it as it is a component of your mark. You will get 0 if you loose this document and it is meant to be a log of actions for this and the next few labs.
Full instructions here [[Admin Log for Networking labs]]
!!2 Backup
Any config files you change copy them to a USB, your H: drive or email them to yourself, if you loose the box for some reason you will have to redo the work, if you have the config files this will be much less painful.
!!3 Configure Apache
This week use your book Chapter 26 and follow the instructions in the apache lab document which may be found [[ here | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/apache/]]
!!Team info, give it to me during the lab, write clearly on a piece of paper:
1 your team members
2 the IP address of the computer you are using
3 the hostname of the computer you are using.
!!MARKING:
Each week I will spot check your system, boot it at the beginning of every lab. Keep your log accessible during lab classes as I will ask to see it from time to time. At the end of term one of the team members will be submitting your log.
I will be checking your live system for your configuration and access to your services each week.
!!Advanced, optional
* Install and run awstats http://www.server-world.info/en/note?os=Fedora_20&p=httpd&f=11
Fill in the information sheet and make sure your webserver is running I will be checking your lab.
If you have not yet done so, complete last weeks lab.
@@Note your findings in your administrative log, I need to see it before you leave.@@
[[Install Wireshark]]
!Part 1
Download the http-sonic.pcap file from [[here| http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/wireshark/http-sonic.pcap]] open it with wireshark and look at the packets. It is a capture of accessing sonic using http. It is easier to find the http if you use the following filter:
{{{
http && tcp.port == 80
}}}
Note the breakdown of the headers, what is the 304 redirect for ?
Note the payload in the last tier of headers.
!Part 2
Start a capture, see what goes by your NIC:
#try using different protocols on your computer, ssh to sonic or a neighbour, load a website (ex sonic), have someone load your website, load someone else's website.
#let it go for a while then stop the capture and look at the content
#notice all the arp packets?
#see what shows up, see if you can identify each communications session for websites, ssh etc
#try an https session, use the filter {{{ tcp.port == 443 }}} to isolate https
#choose an http session
##drill down to see the actual text
##drill down to see the actual text (encrypted
#check the filters try some existing filters http, broadcast etc https://wiki.wireshark.org/DisplayFilters
!!Optional
!!!Sample Captures
from https://wiki.wireshark.org/SampleCaptures
download http.pcap, dhcp.pcap arp-storm.pcap and any others that interest you
!!!try some tcpdump
http://www.commandlinefu.com/commands/using/tcpdump
!!!try snort
https://www.snort.org/
http://www.linuxuser.co.uk/tutorials/protect-your-network-with-snort
Fill in the information sheet for vhosts and make sure your webserver is running I will be checking your vhosts lab.
@@As you do this lab note your findings, observations and answers to any questions in your administrative log. I will be checking it after the lab see here [[Admin Log for Networking labs]]@@
Anything in the next sections that ends in a ? needs to be answered in your log. Do the following on one computer and on a 2nd computer (running linux) update your admin log:
!Part 1
[[Install Wireshark]]
Try it out, figure out how to use it, google or look at the help that comes with the software.
Watch this: https://www.wireshark.org/video/wireshark/introduction-to-wireshark/ (It is video no CC, you need earphones in the labs)
or have a look at https://cs.gmu.edu/~astavrou/courses/ISA_674_F12/Wireshark-Tutorial.pdf
!Part 2
Download the http-sonic.pcap file from [[here| http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/wireshark/http-sonic.pcap]] open it with wireshark and look at the packets. It is a capture of accessing sonic using http. It is easier to find the http if you use the following filter:
{{{
http && tcp.port == 80
}}}
#Note the breakdown of the headers, what is the 304 redirect for?
#What HTTP options are seen in the first GET?
#What ephemeral port is used by the client in the second GET
#Does the ephemeral port change for each get, if so why, if not why not?
#Why do you think there is one GET then a response, then later 2 gets in a row?
#Why don't we see the syn - ack - syn/ack here that is needed for all TCP ?
**think about it, hint filters... try to see it.
!Part 3
Download the "dhcp.pcap (libpcap) A sample of DHCP traffic" from here. https://wiki.wireshark.org/SampleCaptures
#What configuration fields does the server send to the client?
#How long is the lease?
#What does the lease tell you about the type of network this client is joining?
#What are the actual source and destination ports in the payload of the ACK (they are in hex)?
!Part 4
Install telnet then capture telnet and ssh traffic and compare the two.
Your second computer should act as the telnetd/sshd:
{{{
dnf install telnet-server
systemctl start telnet.socket
firewall-cmd ... (fill in the blanks)
}}}
Using firewall-cmd, similar to your http lab (look at your log) allow port 23 for telnet
On the computer you have been using for wireshark:
#Start a capture.
#Using ssh log into your 2nd server and do an ls, then exit.
#Using telnet log into your 2nd server and do an ls, then exit.
#Stop the capture, save it as telnet-vs-ssh.pcap.
Observations:
#What are the differences between the two sessions, what do you see & where?
!Part 5
Start a capture, see what goes by your NIC:
#try using different protocols on your computer, ssh to sonic (or a neighbour) & do an ls
#load a website (ex sonic & others), have someone load your website, load someone else's website within the LAN.
#load a website you have never loaded before to force a DNS lookup
#try an https session
#as you do these and other internet access actions let wireshark it go for a while then stop the capture and look at the content.
Look at your capture (you can save it to a pcap file and start another if you miss something or want to try something else)
#notice all the arp packets, what is arp doing?
#look for the DNS what packets do you see for DNS (for your new request)?
#see what shows up, see if you can identify each communications session for websites, ssh etc (you can use filters but be careful if your filter is wrong you will not see what you want (ex port 22 and UDP you will see nothing)
#for the ssh, what can you see in the packets, can you see when you do an ls on sonic?
#try an https session, use the filter {{{ tcp.port == 443 }}} to isolate https
##drill down to see the actual text (encrypted)
##for the https what can you see in the packet & what can't you see?
#choose an http session
##drill down to see the actual text (not encrypted)
##for the https what can you see in the packet & what can't you see?
#check the filters try some existing filters http, broadcast etc https://wiki.wireshark.org/DisplayFilters
!!Optional
!!!Sample Captures
from https://wiki.wireshark.org/SampleCaptures
download http.pcap, dhcp*.pcap arp-storm.pcap and any others that interest you
!!!try some tcpdump commands (save to pcap & read with wireshark)
http://www.commandlinefu.com/commands/using/tcpdump
!!!try snort
https://www.snort.org/
http://www.linuxuser.co.uk/tutorials/protect-your-network-with-snort
!!Admin Log
For everything you do you need:
# what you configured, in your own words (directive & directory & file names may be needed here)
# what/how you tested "I tested x" is not sufficient
# if it worked OK, say so, say what your results were.
# if it didn't work what did you do to figure it out and fix it
Optional & good practice for your future self:
*commands you used
*config files that were changed
*where you put your backups
This is group work, same group and server as last week
!!Allow http through the firewall
dnf install firewall-config
run firewall config via the menu
select FedoraWorkstation > Permanent & Services tick http & https
reload firewalld Options > Reload Firewalld
[img[http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/firewalld-config.png]]
!!Now verify remote access
You may not have permanently updated your firewall, test your server from a remote box and make sure httpd is up & accessible. If I can't load it you don't get marks. ( if you can't load it do some trouobleshooting and fix it...)
!!Second do this week's lab Virtual Hosts
Instructions here [[vhosts lab |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/vhostslab/ ]]
Once you have selected and pinged your 3 host names, come and write them down for me (read the instructions to understand this statement.)
@@Continue to update your Administrators log with what is done today. I will be giving 25% of the mark for the admin log every week from here on so update it as you do the work. Make sure I can comment on it and make sure everyone in the group can update it.@@
>You will see in the instructions you must have 3 valid, non-duplicated, //ping able// names in the hosts file associated with the IP address of the host you are working on in order to do this lab. If you do not have 3 or the IP address has changed then change it to be sure you do @@and let me know.@@ If you do have 3 valid //ping able// names do not change them because you don't like them. I use this information to mark your lab, don't forget to let me know.
!!MARKING:
Today I will be testing last week's lab. Next week I will test this lab.
I want to see the group using one computer with the admin log being updated while you work on the server on another.
Complete the virtual hosts lab. I will be checking it today, last chance for marks.
For today's lab, on the same server with the same partner you will install and test an ftp server
instructions here [[ftpd lab | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/vsftpd ]]
For today's lab, on the same server with the same partner(s) you will install and test an ftp server.
@@color:green;Admin Logs must be updated as you do this [[Admin Log for Networking labs]]@@
@@Please use a new tab within the same file for the vsftpd lab@@
@@Please share the file with me for edit if you have not yet done so, due to the comment problem.@@
Instructions [[ftpd lab| http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/vsftpd ]] & you will need your book Chapter 19 (v 6 & 7)
While you are doing this lab make observations in your admin log. The log is to be submitted to Lea by May 12, 2015.
!Overview
You are going to write a script to configure iptables for your server as follows:
Allow access to the servers for: ssh, ftp, http
Allow ping from one computer
Allow any connections initiated internally
Block everything else.
Finally "hide" ssh behind port 5555
See below for details
!Instructions
//Run all of your tests from another computer.//
!!Beginning tutorial
#Follow the tutorial here: [[iptables | http://wiki.pcampbell.ep.profweb.qc.ca/index.php/Iptables ]] it will get you started with your first set of rules and you can continue. The tutorial is done live so the rules will not apply after reboot.
!!Regular Rules
Use a script write your own or there is a skeleton script here that you may want to use [[script |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/iptables/]]
#When you apply these rules test it from another computer, make sure you can ssh in but cannot use the ftp nor http servers. This tests both access and blocking. Then continue to add rules.
#Add rules so that you can use your ftp server and your web server.
#Test it, make sure you can use ssh, ftp and http.
#Add a rule so that your computer will allow ping from your neighbour's computer
#Add a rule to drop ping
#Test it, make sure you can use ssh, ftp and http, you cannot ping, except from your neighbour.
!!<nowiki>NATing</nowiki> Rules
Read what you are asked to do, then look here to write the rules http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO-6.html
#Add a rule such that access to port 5555 is redirected to port 22
#Test it, make sure that if you ssh to port 5555 it allows you to login to the computer.
#Test it, make sure you can still use ftp and http, and that ping is blocked, except from your neighbour.
#Add a rule such that access to port 22 is redirect to a high port that you do not use (this has the effect of blocking incoming connections to port 22) It is necessary due to when the NATing is done [[ chain traversal | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/iptables/]]
#* before you do that try to remove the rule accepting port 22 and see what happens when you connect
#* If you wish to do so you can omit this step and change the configuration of ssh so that it listens on port 5555
#** edit /etc/ssh/ssh_config
#** uncomment the Port line and change the port from 22 to 5555
#** do what is necessary
#Test it, make sure that if you ssh to port 5555 it allows you to login to the computer.
#Test it, make sure that if you ssh to port 22 it blocks.
#Test it, make sure you can still use ftp and http, and that ping is blocked, except from your neighbour.
Make sure your vsftpd is running I will be checking your ftp lab.
!Important
Check your selinux status, it must be permissive, if it is anything else this lab will be very difficult to do. You were supposed to have completed this in lab 2 or 3. If it is not permissive follow the instructions here before continuing http://bit.ly/CalmSELinux
For today's lab, on the same server with the same partner(s) you will need to use two linux computers to play around with the packet filter firewall iptables.
@@color:green;Admin Logs must be updated as you do this, and any questions answered (identify the question) [[Admin Log for Networking labs]]@@
!Overview
You are going to write a script to configure iptables for your server as follows:
#Allow access to the servers for: ssh, ftp, http
#Allow ping from one computer
#Allow any connections initiated internally
#Block everything else.
#Finally "hide" ssh behind port 5555
See below for details
!Instructions
//Run all of your tests from another computer. In the instructions I will refer to test computer and firewall.//
When you have finished email all screenshots to pcampbell dot edu at gmail dot com with your team member names as the subject.
!!Install software
Install nmap if it is not already installed. Iptables is installed with the OS.
!!Preliminary
#From your test computer run nmap: {{{nmap -sS -O yourhostname}}} take a screenshot, save it to your Desktop as base-fw.png:
#From your firewall , flush the iptables rules: {{{ iptables -F}}}
#*Show all of the rules after the flush: {{{ iptables -nL}}}
#From your test computer run nmap, take a screenshot, save it to your Desktop as no-fw.png.
#From your test computer run nmap against sonic, take a screenshot, save it to your Desktop as sonic-fw.png.
Preliminary Questions:
#Look in the man pages, what are the options we just used with nmap and iptables?
#Compare the screenshots, what are the differences and why?
!!Beginning tutorial
#Follow the tutorial here: [[iptables | http://wiki.pcampbell.ep.profweb.qc.ca/index.php/Iptables ]] it will get you started with your first set of rules and you can continue. The tutorial is done live so the rules will not apply after reboot.
!!Regular Rules
Use a script, the one from the tutorial is a good start, or there is a skeleton script here that you may want to use [[script |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/labs/iptables/]]
#When you apply these rules test it from another computer, make sure you can ssh in but cannot use the ftp nor http servers. This tests both access and blocking. Then continue to add rules.
#Add rules so that you can use your ftp server and your web server.
#Test it, make sure you can use ssh, ftp and http.
#Add a rule so that your computer will allow ping from your test computer
#Add a rule to drop ping
#Test it, make sure you can use ssh, ftp and http, you cannot ping, except from your test computer, try to ping from another computer, it should not work. Note you can use a client or netcat for this testing.
#Run nmap again take a screenshot, save it to your Desktop as my-fw.png
Regular Rules Questions:
#What are the differences between the screenshots you took at first?
#What was the best way to match for ftp, ssh and http in your firewall rules?
#When you dropped ping in the tutorial it was only to localhost, how did you ensure that ping was dropped completely on your firewall?
!!<nowiki>NATing</nowiki> Rules (port only)
Read what you are asked to do, then look here to write the rules http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO-6.html
#Add a rule such that access to port 5555 is redirected to port 22 (Note your sshd will continue to bind to port 22 but the firewall will redirect it (translate it.))
#Test it, make sure that if you ssh to port 5555 it allows you to login to the computer.
#Test it, make sure you can still use ftp and http, and that ping is blocked, except from your neighbour.
#Test it, try to ssh to port 22, does it work?
#Add a rule such that access to port 22 is redirect to a high port that you do not use (this has the effect of blocking incoming connections to port 22) It is necessary due to when the NATing is done [[ chain traversal | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/iptables/]]
#* before you do that try to remove the rule accepting port 22 and see what happens when you connect
Another way to do this:
#If you wish to do so you can omit this step and change the configuration of ssh so that it listens on port 5555
# edit /etc/ssh/ssh_config
#* uncomment the Port line and change the port from 22 to 5555
#* do what is necessary (reload the server)
#Test it, make sure that if you ssh to port 5555 it allows you to login to the computer.
#Test it, make sure that if you ssh to port 22 it blocks.
#Test it, make sure you can still use ftp and http, and that ping is blocked, except from your test computer.
*[[Lab Install to disk|Install to disk]]
*[[Things to do to tweak the install]]
<html>
<head>
<title>
Lab Week 4 Install software
</title>
<h2>Chapter 13 (6th ed) Chapter 12 (7th ed) Downloading & Installing Software
</h2>
<h3>Preparation</h3>
In order to get some of the data you will need to install wget:<br>
<pre>
yum install -y wget
</pre>
Installation is an administrative task, you will need to use sudo either for each command or use sudo to switch user to root. @@don't miss out the -@@
<pre>
[a@b ~]$ sudo su -
</pre>
<pre>
[root@b ~]#
</pre>
<hr>
<h3>Install using a tarball</h3>
<a href=http://linuxstuff.tiddlyspot.com/#%5B%5BInstall%20Asciiaquarium%5D%5D/>
Install Ascii Aquarium
</a>
<hr>
<h3>Download and install an rpm, using the rpm utility</h3>
<a href=http://www.webmin.com/rpm.html
>Install Webmin
</a>
<br> To test it load http://localhost:10000/ in your browser and logon using your root uid + password.
Look around, for example find the users you created at the command line.
<hr>
<h3>Install using yum</h3>
<ol><li>Update the system packages
<PRE>
[root@b~]# yum update
</pre>
<li>VLC (and the rpm fusion repository)
<ol>
<li>Download the rpm for the rpmfusion free and non-free repositories : <br>
You may have installed one of these already (stable), but try them and see what happens.
<pre>
wget http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-21.noarch.rpm
wget http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-21.noarch.rpm
</pre>
<li>Install the rpms that will install the repositories: <br>
<pre>
yum localinstall --nogpgcheck rpmfusion-free-release-21.noarch.rpm
yum localinstall --nogpgcheck rpmfusion-nonfree-release-21.noarch.rpm
</pre>
<li>Install VLC (use the repositories:)<br>
<pre>
yum update
yum install vlc -y
</pre>
</ol>
<li>Install Using another repository
</li>
<a href=http://www.if-not-true-then-false.com/2010/install-google-chrome-with-yum-on-fedora-red-hat-rhel/>
Install Google Chrome browser
</a>
</ol>
</html>
!Using Yum install & run the following
*oneko ( cat chases the cursor)
*xeyes, run it to illustrate foreground/background processes
*fortune
*cowsay
*choose an alternate terminal emulator: http://www.tecmint.com/linux-terminal-emulators/ I like terminator
*gnome-tweak-tool
!!Using Yum groupinstall install an alternate desktop environment
Choose one from the list:
{{{
yum grouplist |grep -i desktop
}}}
Do a groupinstall
{{{
yum groupinstall "chosen package name"
}}}
log off then log on using the alternate desktop
@@Future do not do this today@@
*[[configure dawson printers]]
*download source code and compile http://rpm.pbone.net/index.php3?stat=26&dist=7&size=210621&name=groach-0.2.0-1.src.rpm
!!The steps are given in detail with hints for most steps, code this script one component at a time, test each component, then add the next. <br><br>Code a script called dirchk.sh that displays information about what is contained in a directory.
@@You are using command line arguments, local variables, environment variables, if statements, file test operators, command substitution, tar and some other commands@@
''n.b All scripts must start with the 4 required statements''
* interpreter designatorfile
* your name
* date
* purpose of the script
!!!Specification
* Have 1 local variable name, assign it your full name, use it in all messages
* Expect 1 command line argument, a directory,
* If there is not 1 command line argument, display an error message and exit the script.
* If the current user is root, display an error message and exit the script
* Display a welcome message to the current logged on user (use an environment variable)
* Test the command line argument, if it is not a directory, display a message and exit the script.
** bash file test operators http://tldp.org/LDP/abs/html/fto.html
* Display a message something like Information about <the name of the directory .>
* Display a count of the number of subdirectories of this directory.
** suggestion: use a combination of ls and grep or find and grep //check the man pages//
* Display a count of the number of files in the directory.
** suggestion: use a combination of ls and grep or find and grep //check the man pages//
* List all of the files in the directory that are zero length
** suggestion: use an option of the find command //check the man pages//
* Use du to display the amount of storage space used by this directory
** //check the man pages// for du
* Backup the contents of the directory using tar (with tar use bzip2 to compress the tarball.)
** create the tarball in /tmp
** the file name should be <nowiki>YYYY-MM-DD-<dirname>.tbz2</nowiki> (hint use basename for dirname & use date, look at %F and use command substitution)
* Display a long listing of the tar ball file
* Display a long listing of the tar ball contents (use tar)
* Display a message using the local variable name: Brought to you by ...
!!Part 2 (not optional)
* Once the above is complete and working create a backup copy and modify it to put it into a while or until loop:
** the first run uses the command line argument, or complains
** on subsequent iterations ask the user if they want to enter another directory
** if the response is N then exit the loop/script
** if the response is anything else then use the original logic.
Code this script one component at a time, test each component, then add the next.
It may be easiest to test this by creating a directory with a couple of directories, files and empty files, test with that.
Once all of the code is done test it with a another directory.
TEST: Make certain that your output is correct, the displayed output AND the tarball.
You may not finish this during the lab, continue it on your own time.
!!Using case and a loop
Using the same idea as in Two of [[Lab Week 6 2015]] create a guessing game, choose three different letters that may be guessed. Make it case insensitive
Using the loop of your choice use either a compound condition or use another variable that can be set to indicate the loop is finished.
Inside the loop use a case statement, be sure to match on all 3 possible letters, upper and lower case. For example
{{{
while [ $bordercond != out ] do
case guess in
[aA] ) echo " you guessed right!"
bordercond=out
;;
blah ) echo " you guessed right!"
bordercond=out
;;
* ) echo "try again"
;;
esac
done
}}}
!!Similar to the in class exercises, you can use the function fexist
{{{ ./scopy.sh dirname f1 f2 f3.. }}}
Write a script to do a safe copy to a directory.
Minimum 2 arguments.
The 1st arg is the directory destination, if it doesn't exist, use a loop to ask for a directory until they enter a directory or q for quit.
The rest of the args are a list of files to be copied into the directory, if the file exists in the destination directory copy then append the pid to the file name.
If the file doesn't exist in the destination directory do a regular copy to the destination directory.
ex: if myfile exists in directory dest cp myfile dest/myfile.$$
If the arg is not a file, add to an error count and do not copy it.
Function fexist() spec: a function to test if arg is a file, return 0 if it is, 1 otherwise.
At the end show the count of skipped arguments. (error count).
For reference see [[regex sed ref]]
!xkcd on regex
*http://xkcd.org/208/
*http://xkcd.org/1313/
*http://xkcd.org/1171/
*http://xkcd.org/1031/
!Write a script to prompt the user to enter a string, read it in then match it to a series of regular expressions as follows (they are case sensitive):
You may use read or you might want to install [[xdialog]] which provides Xdialog
If the string matches the regex pattern, display the pattern and the matching string.
Do it incrementally, implement the first one, make sure it works (test for match and no match) then add the rest.
You may want to put this in a loop and check for quit (any case) to end it, this would be a regex too.
# ends with: Linux
# begins with: Linux
# contains the string unix
#*contains the string unix any mixed case
# begins with an upper case letter
# does not contain a number (0-9) anywhere
# contains Windows or Linux or windows or linux
# contains thingg (with minimum 2 g maximum 5 g on the end)
# does not contain any whitespace
# contains Linux (with 0 or more x on the end)
# contains the word Tux (preceded and followed by blank)
# challenge: any word that ends in nix
n.b. for the //does not contain// you may need to play around with anchors and try a few things
!TESTING
Here are some lists you can test against [[regex test lists]]
If you want a further challenge you can read in the list using while [[read file with while]]
!Challenge
How would you do this if you were checking against a sentence typed in at the command line as cli args?
There are two parts to this lab. They are to be done as a team, on your installed systems in the lab. Part 1 you must hand in the form for your group. Part 2 I will spot check over the next few labs.
!Setup
Open a terminal, maximize it and run the following
{{{
curl -L http://bit.ly/10hA8iC | bash
}}}
!Part 1 Network Configuration
The first part is looking at your network configuration through the instructions in this pdf [[net config |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-week10-2014/241-network-config-instructions.pdf ]] as you go through it you will be able to fill out the form found here in txt format [[ form | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-week10-2014/net-config-ex1-form.txt ]] which you will want to download and fill in. You will have to hand this in to me so print it.
!Part 2 User Administration
Follow the instructions in this pdf [[ here | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-week10-2014/241-manage-user-accounts-lab-only.pdf ]] You will be creating users with a shared group and directory.
Today we will start to configure network services. You must do this with your team on your Linux install in the lab.
You will be doing this configuration and others over the next few weeks, until the end of term. I will check your progress every week. This week you will start your Administrator's log and configure Apache. Be sure to back up any configuration files you use (copy them to a USB or other, or email them to yourselves) If you lose configuration you may have to use your admin log to recreate it, so be thorough in your writing.
@@Please read the instructions below before downloading the files.@@
!!Administrators Log
You will keep an administrators log of what is done to your server, when it is done , and by whom. A sample is given named 241-sampleAdminSystemLog.ods (libre office spreadsheet.) Keep your team file USB or google doc or dropbbox do not loose it as it is a component of your mark.
All instruction and support files may be found here http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-apache-2014/
!!hosts file
All instruction and support files may be found here http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-apache-2014/
Download the hosts file from sonic. To replace your hosts file with the downloaded file :
{{{
$ sudo su -
# cp /etc/hosts ~/hosts.$(date +%F)
# cp /home/<user who downloaded it>/Downloads/hosts.for.apache.lab /etc/hosts
}}}
It is @@important@@ that you check your host name and ip address against the file, if it is incorrect let me know. If I can't get to your server because you have not told me about an error in the hosts file you will miss marks.
!!Configure Apache
This week follow the instructions in the apache lab document
All instruction and support files may be found here http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-apache-2014/
!!MARKING:
Keep your log available during class as I will ask to see it from time to time. At the end of term you will be submitting your log. However during the next few weeks I will be checking your live system for your configuration and access to your services.
!!Advanced, optional
* Install and run awstats http://www.server-world.info/en/note?os=Fedora_20&p=httpd&f=11
Group work, instructions here [[wireshark lab | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-wireshark-2014 ]]
[[THIS WEEK REGISTER on the edublog]]
Group work, instructions here [[ftpd lab | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-ftp-2014 ]]
Group work, instructions here [[vhosts & iptables lab |http://sonic.dawsoncollege.qc.ca/~pcampbell/241/lab-apache-virthosts-2014/ ]]
You are going to write a script to configure iptables for your server as follows:
Allow access to the servers for: ssh, ftp, http
Allow ping from one computer
Allow any connections initiated internally
Block everything else.
Finally "hide" ssh behind port 5555
!Instructions
//Run all of your tests from another computer.//
!!Regular Rules
#Follow the tutorial here: [[iptables | http://wiki.pcampbell.ep.profweb.qc.ca/index.php/Iptables ]] it will get you started with your first set of rules and you can continue here:
#Test it from another computer, make sure you can ssh in but cannot use the ftp nor http servers. This tests both access and blocking.
#Add rules so that you can use your ftp server and your web server.
#Test it, make sure you can use ssh, ftp and http.
#Add a rule so that your computer will allow ping from your neighbour's computer
#Add a rule to drop ping
#Test it, make sure you can use ssh, ftp and http, you cannot ping, except from your neighbour.
!!<nowiki>NATing</nowiki> Rules
Read what you are asked to do, then look here to write the rules http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO-6.html
#Add a rule such that access to port 5555 is redirected to port 22
#Test it, make sure that if you ssh to port 5555 it allows you to login to the computer.
#Test it, make sure you can still use ftp and http, and that ping is blocked, except from your neighbour.
#Add a rule such that access to port 22 is redirect to a high port that you do not use (this has the effect of blocking incoming connections to port 22) It is necessary due to when the NATing is done [[ chain traversal | http://sonic.dawsoncollege.qc.ca/~pcampbell/241/iptables/]]
#* before you do that try to remove the rule accepting port 22 and see what happens when you connect
#* If you wish to do so you can omit this step and change the configuration of ssh so that it listens on port 5555
#** edit /etc/ssh/ssh_config
#** uncomment the Port line and change the port from 22 to 5555
#** do what is necessary
#Test it, make sure that if you ssh to port 5555 it allows you to login to the computer.
#Test it, make sure that if you ssh to port 22 it blocks.
#Test it, make sure you can still use ftp and http, and that ping is blocked, except from your neighbour.
!!Complete this lab script before proceeding to the assignment. <br>The steps are given in detail with hints for most steps, code this script one component at a time, test each component, then add the next. <br><br>Code a script called dirchk.sh that displays information about what is contained in a directory.
@@You are using command line arguments, local variables, environment variables, if statements, file test operators, command substitution, tar and some other commands@@
''n.b All scripts must start with the 4 required statements''
* interpreter designator
* your name
* date
* purpose of the script
!!!Specification
* Have 1 local variable name, assign it your full name, use it in all messages
* Expect 1 command line argument, a directory,
* If there is not 1 command line argument, display an error message and exit the script.
* If the current user is root, display an error message and exit the script
* Display a welcome message to the current logged on user (use an environment variable)
* Test the command line argument, if it is not a directory, display a message and exit the script.
** bash file test operators http://tldp.org/LDP/abs/html/fto.html
* Display a message something like Information about <the name of the directory .>
* Display a count of the number of subdirectories of this directory.
** suggestion: use a combination of ls and grep or find and grep //check the man pages//
* Display a count of the number of files in the directory.
** suggestion: use a combination of ls and grep or find and grep //check the man pages//
* List all of the files in the directory that are zero length
** suggestion: use an option of the find command //check the man pages//
* Use du to display the amount of storage space used by this directory
** //check the man pages// for du
* Backup the contents of the directory using tar (with tar use bzip2 to compress the tarball.)
** create the tarball in /tmp
** the file name should be <nowiki>YYYY-MM-DD.tbz2</nowiki> (hint use date, look at %F and use command substitution)
* Display a long listing of the tar ball file
* Display a message using the local variable name: Brought to you by ...
Code this script one component at a time, test each component, then add the next.
It may be easiest to test this by creating a directory with a couple of directories, files and empty files, test with that.
Once all of the code is done test it with a another directory.
TEST: Make certain that your output is correct, the displayed output AND the tarball.
Before you begin, have a look at the teacher's solution to Lab 5 on moodle.
Today you are going to write some scripts to use the features of bash that you have learned. (arithmetic, if/then/else/elif, while/until, here document, (maybe case/switch)
They are short but be sure to draw a flowchart before beginning so you have a plan.
!!Warmup/review: if / then / elif /else
Using a command line argument, with the appropriate verification & error messages [ if there is a command line argument use it, if not error message and exit ]
Expect a command line argument that is a file. (This means: If the command line argument is not a file give an appropriate error message and exit.)
Get the file size in bytes into a variable, using command substitution. //It is best to try the commands at the cli before using them in a script// if you can't remember how see here [[bash command substitution]]
If the file size is < 1KiB display an appropriate message
else if the file size is < 1MiB display an appropriate message
else if the file size is < 1GiB display an appropriate message
else display an appropriate message
!!One: while / until, read, arithmetic
Ignore command line arguments.
Using the loop of your choice //(not for)// write a guessing game.
Create a variable, assign it your hidden letter, to be guessed.
Prompt the user to enter a letter of the alphabet. If they enter the correct letter display an appropriate message and exit the loop.
Keep a count of guesses, display it to them with each iteration of the loop.
Allow them to exit if they type letmego, no message.
Ensure that it is case insensitive so a guess of if your secret letter is a, then A or a would be correct.
!!Two: for, arithmetic
Using one or more command line arguments. If there are none display an appropriate message.
Expect one or more command line arguments that are directories.
Using command line arguments as your list within a for loop:
Check to see if it is a directory
If it is not a directory display an appropriate message
Using the contents of the directory as your list //(ls)// within a for loop display information about the entry: directory, file, symbolic link, you are/are not the owner (see file test operators http://tldp.org/LDP/abs/html/fto.html)
As you loop keep a count of files, directories and symbolic links, display them at the end of the script.
Arithmetic operators http://tldp.org/LDP/abs/html/ops.html
Arithmetic //operations// http://tldp.org/LDP/abs/html/arithexp.html
!!Three: if / then / elif /else, for, here document, arithmetic
Expect 2 command line argument, with the appropriate verification & error messages [ if there are 2 command line arguments OK, if not error message and exit ]
./setup.sh <classname> <classlist.txt>
Of the two arguments one must be the name of the class and the other is a file containing student names. Make sure that one argument is a file, use that argument as the list of student names. The other is a class name to be used as a directory.
If the directory exists display an error message and exit.
Make a new directory using the class name.
Within that directory create a directory for each student name in the file. Keep a count as you go through the entries.
In each student directory create a file welcome.txt using a here document, all of the entries in <> must be stubstituted:
{{{
Hello <student name>,
There are <total count> students in the class you are number <counter>
Welcome to the best course at Dawson College: <classname>.
You will learn a lot!
Sincerely, your teacher,
<yourname>
}}}
Check if the student has an account on this computer. If they do not have an account append an error message "no userid here for <student name> to a log file named <scriptname>.log
Hint: Use grep and /etc/passwd, check the return/status code of grep
Arithmetic operators http://tldp.org/LDP/abs/html/ops.html
Arithmetic //operations// http://tldp.org/LDP/abs/html/arithexp.html
Before you start this script be sure you have completed the scripts from last week's lab.
Today you are going to write some scripts to use the features of bash that you have learned.
Be sure to draw a flowchart before beginning.
@@I will be posting a new Assignment at the end of the week, check Léa.@@
!Lab Script: for, case, function
Using the same idea last week's guessing game script where you guessed one number. Write another script where the user can guess any one of 3 letters and at least one number (For the number the digits or the written number are ok, 1 = one)
Using the loop of your choice (not for) write a guessing game. Your border condition(s) will allow the loop to end if any of the letters or number(s) is guessed.
Inside the loop use a case statement, be sure to match on all possible letters and number(s), upper and lower case.
Set up logic so that if one of the letters numbers or letmego is typed you get out of the loop.
Keep all of the logic from last week (below) and when they guess correctly display the count of the number of times they have guessed.
Create a function that displays a usage message, if the user gives you any command line arguments, use the function to display the usage message and exit the script.
!!!Last Week: or look here [[Lab week 6]]
{{{
One: while / until, read, arithmetic
Ignore command line arguments.
Using the loop of your choice (not for) write a guessing game.
Create a variable, assign it your hidden letter, to be guessed.
Prompt the user to enter a letter of the alphabet. If they enter the correct letter display an appropriate message and exit the loop.
Keep a count of guesses, display it to them with each iteration of the loop.
Allow them to exit if they type letmego, no message.
Ensure that it is case insensitive so a guess of if your secret letter is a, then A or a would be correct.
}}}
Today you are going to write a script to do bash arithmetic, use while or until, use case and write functions
Be sure to draw a flowchart before beginning.
Note: bash can only do integer arithmetic, if you are interested see Phase 4 below and [[bash and floating point arithmetic]] Hints: [[ bash arithmetic |http://linuxcommand.org/lc3_wss0100.php]]
!Phase 1
Ignore command line arguments. Have a welcome message. Put the logic in a while or until loop continue unless the user types any of q/quit/Q. When you are quitting have a goodbye message. Ask the user to input two numbers. Ask the user whether they want to add, subtract, divide, multiply, get the modulus or exponential values. You must prompt the user, the prompts may take any form you wish: a, add, addition, A etc, use at least two options, you decide what is valid and check for it. For this phase, assume they are valid numbers.
Evaluate their selection using a case statement. You will do the arithmetic by passing the two numbers to the appropriate function (see below).
Display the results to the users along with the numbers they entered
Keep a running total of the number of calculations, update the counter in each function, show the total in the goodbye message.
An example run with example partial implementation (you add the rest of the arithmetic operations):
{{{
./week8.sh
Welcome to Calcutron
Do you want to Add, Subtract
A
Give me a number: 12
Give me another number: 14
Calcutron says 12 + 14 = 26
Do you want to Add, Subtract
Q
Calcutron is sad, we did 1 thing for you, come back soon.
Another fine piece of coding, brought to you by P. Campbell 2014
}}}
//@@As you develop this script do addition first, make sure it works then do the other arithmetic operations. __Incremental development!!__@@//
Be sure to test all functions and try to divide by zero.
<hr>
!!functions
!!!function to add two arguments, set the result in a global variable
{{{addup 12 14; echo $sumvar # displays 26}}}
!!!function to subtract two arguments, set the result in a global variable
!!!function to divide two arguments, set the result in a global variable
Check that the divisor is not zero, do not divide by zero.
!!!function to multiply two arguments, set the result in a global variable
!!!function to modulo two arguments, set the result in a global variable
!!!function to give the exponential value of two arguments, set the result in a global variable
! Phase 2 using regex, check for numeric arguments
Develop this function in a separate script. Test it using this script and once you are sure it is working put it in the original script and use it to check that your numbers are actually numbers before performing arithmetic
!!!function to ensure that any arguments given to it are numbers only. Use regex, set return code to 0 if numeric, 1 if non-numeric
{{{
isnumeric 12 ; echo $? # displays 0
isnumeric r5; echo $? # displays 1
}}}
! Phase 3 quick arithmetic (optional)
If 3 command line arguments are entered, check for an option -a (add), -s (subtract) etc. Perform the arithmetic. Be sure to keep the code that reads from the user, use it if there are not sufficient command line arguments. For example:
{{{
./myscript.sh -m 5 6
results: 5 * 6 = 30
./myscript.sh -a 5 6
results: 5 + 6 = 11
./myscript.sh -a
Do you want to Add, Subtract
A
Give me a number: 12
etc
}}}
If you want to get really fancy the arguments can be in any order. For example the following will also work:
{{{
./myscript.sh 5 -m 6
results: 5 * 6 = 30
./myscript.sh 5 6 -a
results: 5 + 6 = 11
}}}
!! Phase 4 floating point arithmetic (optional)
Ensure that any arithmetic results are floating point see [[bash and floating point arithmetic]]
@@Regex Quick Ref http://bit.ly/regex2014@@
! If you have not yet done so finish phase 2 of [[Lab week 8]] (function to use regex to check for numbers, hint you will need digits, modifiers and anchors.)
! Today's lab Part 1
You are going to write a script to use regex to parse data in a file. The file is supposed to contain 1 line per person phone number followed by the last name, you will verify this using regex.
Be sure to plan before beginning (flowchart, structured English etc.)
Expect a file as input at the command line, if not ask the user to enter a file name, you need only do this once, if they enter nulls, give an appropriate message and exit.
Check that the input is a file, if not ask the user to enter a file name, you need only do this once, if they enter nulls or it is not a file, give an appropriate message and exit.
Before you begin use wc to store the count of the lines in the file in a variable.
Parse the file's contents (hint: use for and command substitution) using functions for each of the following.
*null or blank line: use regex to check for null line, keep a count of null lines
*invalid line (not null, not valid) (no function for this, just a counter)
*valid line:
**phone number followed by one or more whitespace characters followed by Upper case letter, followed by one or more lower case letters, examples:
{{{
999-999-9999 Lastname
(999)-999-9999 Lastnamemaybeshortorlong
}}}
Keep a counter for each type of line and display it at the end along with the number of lines from wc.
Using arithmetic verify your counts versus the count of the lines in the file, display all of this information.
! Today`s lab Part 2 check the same file using the sed command instead of a bash script
From the original file take only the valid lines to put in the result file, ignore blank and invalid lines.
complete after the sed lecture or have a look at: [[regex sed ref]]
! Part 3 [[sed exercise]] (optional but it will help you understand sed)
You will find the marked lab results in the links for [[section1|https://docs.google.com/spreadsheets/d/1-NKhaXts5Bbv2lXW0nRYfXu_991Il6X8ECiqEvIkhT8/edit#gid=0]] and [[section2|https://docs.google.com/spreadsheets/d/1mKcgw5YPI00FqWilAnnyP9TQ4nhRz8z6PQfm5naOhCk/edit?usp=sharing]] these are open now, see the tabs for feedback, see me during my office hours for marks.
SECTION 1: Monday Lab April 29, 2019: do Lab 13
SECTION 2: Thursday Lab May 2, 2019 do Lab 14
SECTION 1: Monday Lab May 6, 2019: do Lab 14
!!Lab 14
[[using iptables packet filter|https://docs.google.com/document/d/1mbWdMhj80BLeh-Gt0t_-6an5LUtSb54uqhEWIAyYKj0/edit?usp=sharing]]
!!Lab 13
Section 1: You will be doing this lab next week, Mon May 6, 2019
Section 2: Thursday lab, this lab is due Weds May 1, 2019
[[Use wireshark to analyse traffic and answer some questions|https://drive.google.com/drive/folders/0B-CHlg81QPjfaWh1c19rS0FsOXM?usp=sharing]]
!!Lab 12
* [[ update your hosts file|https://docs.google.com/document/d/1w1i75rNk2TKwDtPQH8p4j5XfglefnL-pM-WcadJARO0/edit]]
* [[ install & start apache|https://docs.google.com/document/d/1smM88jfatX4NJe1aIz32BsswAowd5scsNFJUY2CO0_A/edit?usp=sharing]]
!!Lab 11
* [[lab set up a mini web server|https://docs.google.com/document/d/1fxWa5loUrX2b7S3Z9avniDu3_mOiuR_pZkHHjZ1XigE/edit?usp=sharing]]
* [[lab network config exploration|https://docs.google.com/document/d/1H0PfkFAo9DolB74EYMBcCqlN5sG3LLWbMTIj6jLRyRU/edit?usp=sharing]]
* [[info on sudo|https://linuxacademy.com/blog/linux/linux-commands-for-beginners-sudo/]]
!!Lab 10
!!! Part 1
[[install some software|https://docs.google.com/document/d/1P24vexxLwEnKJiOm1OYEYvdJCkjKspX6BVP4jgAgCFY/edit?usp=sharing]]
!!! Part 2
[[work with users|https://docs.google.com/document/d/1_-NNF_6ZHZ0MT_l1tdbmRGGlZOGcGnlIAu2r7SVxmYo/edit?usp=sharing]]
!!Lab 9
As you do this lab use the slides from moodle and [[regex sed ref]] to help you.
Lab Instructions [[Scripting with regex|https://docs.google.com/document/d/1WvfVfXJoWZ8P1NZb416gQMBRrzy-m4TtMSsdohBh7ds/edit?usp=sharing]]
!!Lab 8
As you do this lab use the slides from moodle and [[bash ref]] to help you.
Lab Instructions [[Scripting with functions|https://docs.google.com/document/d/1l7a0AHG_yCj0-5QC8txHhhc-NQyJAGoiO5TKIQxngmk/edit?usp=sharing]]
!!Lab 7
no lab due to midterm
!!Lab 6
The teacher will go over solutions to lab 5 in the class before you do this lab, please pay attention, it will gain you assignment grades.
And it will help you on the midterm.
As you do this lab use the slides from moodle and [[bash ref]] to help you.
Lab Instructions [[More Scripting|https://docs.google.com/document/d/1MnxJynU_hNxPUyKsrcylQc7UwoMV2CqYSnKU2n-IHl4/edit?usp=sharing]]
!!Lab 5
//Everyone:// logon to your VM using putty & your ip
or via the web browser https://dc385.dawsoncollege.qc.ca/
logon using your userid NOT administrator
Section 1: logon using your userid your password is Dawson123 please change it.
Lab instructions [[VI & Scripting|https://docs.google.com/document/d/1qxDOwKkx-YIRpJ-T79lnGQv2mouukBwJIeOEcw1oJMI/edit?usp=sharing]]
!!Lab 4
//There will be a quiz next week//
#[[Check out the USB you made |https://docs.google.com/document/d/1XwuOdDCgqh9pMJWlkjb-6fdkQSUnZ5AWOX6NF4LsjW0/edit?usp=sharing]]
#[[Configure your VM| https://docs.google.com/document/d/1fKqztI1ZhAn34fUYj2aPiYkdAkBwROCzEk0tFXCCNN4/edit?usp=sharing]]
!!Lab 3
[[Install Ubuntu & Boot USB | https://docs.google.com/document/d/1E3MP0Ow1QAeUhu0f0CZE8f7auGVv5NASeAd898sIrNc/edit?usp=sharing]]
!!Lab 2
[[Review quiz answers plus | https://docs.google.com/document/d/1WTbF-xecfgx07pn2nUDzuIJwqeCSImfL-aCCEOgmdKk/edit?usp=sharing]]
!!Lab 1
*//This is multi-page, take your time, think about and test your answers. This quiz will be marked but consider it open book. You will need to logon to save your answers. If you are stuck or don't know something use the man pages & try things out on sonic. Discuss ideas with friends/not answers//<br>You can also use https://ss64.com/bash https://linux.die.net
*[[Review Quiz | https://goo.gl/forms/0bbkM1ouGcfjs3Fb2]]
*[[Lab (week 14)]]
*[[Lab (week 13)]]
*Lab (week 12) see moodle
*[[Lab (week 11)]]
*[[Lab Script and sed (week 10)]]
*[[Lab Script (week 9)]]
*[[Lab Script (week 8)]]
*[[Lab Script (week 7)]]
*[[Lab Script (week 6)]]
*[[Lab Script (week 5)]]
[[Main Page 2014]]
[[2014-04-16 tutorial]]
[[2014-04-23 tutorial]]
!Labs
[[Lab week 4]]
[[Lab week 5]] see moodle for my solution to a similar lab/assignment
[[Lab week 6]] warmup script here: [[warmup.sh]] and One Two Three here: [[My solutions to lab 6]]
[[Lab week 7]]
[[Lab week 8]] solution [[my solution to lab week 8 phase 2]]
[[Lab week 9]]
[[Lab week 10]]
[[Lab week 11]] Section 1 Week 11, Section 2 Week 12
[[Lab week 12]] Section 1 Week 12, Section 2 2014-04-22
[[Lab week 13]] Section 1 2014-04-23, Section 2 2014-04-29
[[Lab week 14]] Section 1 2014-04-30, Section 2 2014-05-06
[[Lab week 15]] Section 1 2014-05-07, Section 2 2014-05-13
[[sample scripts]] (updated weekly)
*Week 1 Quiz
*Week 2 [[Install to USB | http://sonic.dawsoncollege.qc.ca/compsci/index.php/Install_to_Bootable_USB]]
** If the main fedora website is too slow to access the ISO may be downloaded from sonic, see link in the instructions, or copied from S:\CompSci\241
*Week 3
**Part 1 [[Install to disk]]
**Part 2 [[Things to do to tweak the install]]
*Week 4
**[[Lab Week 4 2015]]
**Do [[vimtutor]]
*Week 5
**Do [[vimtutor]]
**[[Lab Week 5 2015]]
*Week 6
**If you have not done so, complete [[vimtutor]] maybe play http://vim-adventures.com/
**[[Lab Week 6 2015]]
*Week 7
**[[Lab Week 7 2015]]
*Week 8 @@Midterm@@
*Week 9 after Spring Break
**[[Lab Week 9 2015]]
*Week 10 Section 1 (Wednesday 2015-04-01) Section 2 (Tuesday 2015-04-07)
**[[Lab Week 10 2015]]
*Week 11 Section 1 (Wednesday 2015-04-08) Section 2 (Tuesday 2015-04-14)
**[[Lab Week 11 2015]]
*Week 12 Section 1 (Wednesday 2015-04-15) Section 2 (Tuesday 2015-04-21)
**[[Lab Week 12 2015]]
*Week 13 Section 1 (Wednesday 2015-04-22) Section 2 (Tuesday 2015-04-28)
**[[Lab Week 13 2015]]
*Week 14 Section 1 (Wednesday 2015-04-29) Section 2 (Tuesday 2015-05-05)
**[[Lab Week 14 2015]]
*Week 15 Section 1 (Wednesday 2015-05-06) Section 2 (Tuesday 2015-05-12)
**[[Lab Week 15 2015]]
*Week 1 (starting in first full week) [[Lab Week 01 2016 USB install]]
*Week 2 [[Lab Week 02 2016 Install to hd]]
*Week 3 [[Lab Week 03 2016 Install Software]]
//BASH SCRIPTING STARTS//
@@color:red;bash syntax is not java syntax do not make assumptions
DO NOT google, I have given you several links, use the [[abs scripting guide | http://tldp.org/LDP/abs/html/index.html]] or other links and information on this website
You are not going to learn anything from cut & paste & you may incorporate errors if you take things from random websites (including/especially stack overflow). @@
*Week 4 [[Lab Week 04 2016 Scripting]] see [[Lab Week 05 2017 Scripting]]
*Week 5 [[Lab Week 05 2016 Scripting]]
*Week 6 [[Lab Week 06 2016 Scripting - functions]] see [[Lab Week 07 2017 Scripting - functions]]
*Week 7 [[Lab Week 07 2016 Scripting - regex & functions]]
*Week 8 [[Lab Week 08 2016 Using sed]]
//SERVER ADMIN STARTS//
@@color:red; All labs from now on will have to be completed in the lab itself on your server.
If you don't understand something try *reading* the instructions, then use man pages, then maybe google, or ask me@@
*Week 9 [[Lab Week 09 2016 User Admin]]
*Week 10 [[Lab Week 10 2016 Network]]
From here on you will be setting up a server with ftpd, sshd, httpd and setting a firewall, you will have to keep an Administrators log which you will share with me it will be for part of the marks. See here for details [[Admin Log for Networking labs]]
*Week 11 [[Lab Week 11 2016 Apache]]
*Week 12 [[Lab Week 12 2016 Apache Virtual Hosts]]
*Week 13 [[Lab Week 13 2016 WireShark ]]
*Week 14 [[Lab Week 14 2016 vsftpd ]]
*Week 15 [[Lab Week 15 2016 iptables ]] Woot! last lab!!!
[[Lab marks spreadsheet|https://docs.google.com/spreadsheets/d/1uLc_v9-8uLJQmxyxprQAJ_aHW3j1ya283qDZDCFLVeM/edit?usp=sharing]] Currently missing the marks for a few, I have to add all of my spreadsheets here.
*Week 1 [[Review Quiz | https://goo.gl/forms/0bbkM1ouGcfjs3Fb2]] you will need to logon to save your answers, you may use man pages & try things out before answering.
*Week 2 [[Lab Week 02 2017 USB install]]
*Week 3 [[Lab Week 03 2017 Install to HDD]]
*Week 4 [[Lab Week 04 2017 Install Software]]
*Week 5
** You must boot into your linux box and do the scripting labs on your own boxen
** do not shutdown or reboot without asking me first, I will be testing your previous labs
** lab instructions: [[Lab Week 05 2017 Scripting]]
*Week 6
** You must boot into your linux box and do the scripting labs on your own boxen
** do not shutdown or reboot without asking me first, I will be testing your previous labs
** lab instructions: [[Lab Week 06 2017 Scripting]]
*Week 7
** You must boot into your linux box and do the scripting labs on your own boxen
** DO NOT SHUTDOWN reboot without asking me first, I will be extracting your lab6
** DO NOT SHUTDOWN reboot without asking me first, I will be extracting your lab6
** lab instructions: [[Lab Week 07 2017 Scripting - functions]]
Spring Break
*Week 8
** You must boot into your linux box and do the labs on your own boxen
** DO NOT SHUTDOWN reboot without asking me first, I will be extracting your lab7
** DO NOT SHUTDOWN reboot without asking me first, I will be extracting your lab7
** lab instructions: [[Lab Week 08 2017 Scripting using regex]]
*Week 9
** You must boot into your linux box and do the labs on your own boxen
** DO NOT SHUTDOWN reboot without asking me first, I will be extracting your lab8
** DO NOT SHUTDOWN reboot without asking me first, I will be extracting your lab8
** lab instructions: [[Lab Week 09 2017 Using sed]]
//SERVER ADMIN STARTS//
@@color:red; All labs from now on will have to be completed in the lab itself on your server.@@
*Week 10
** DO NOT SHUTDOWN reboot without asking me first, I will be extracting your lab9
** DO NOT SHUTDOWN reboot without asking me first, I will be extracting your lab9
** lab instructions: [[Lab Week 10 2017 User Admin]]
*Week 11
** The printed outcome of last weeks lab is due today, put it on my desk.
** lab instructions: [[Lab Week 11 2017 Network Config]]
*Week 12
** The printed outcome of last weeks lab is due today, put it on my desk.
** lab instructions: [[Lab Week 12 2017 Apache]]
*Week 13
** Complete the lab from last week & once it is working do the virtualhosts lab
** lab instructions: [[Lab Week 13 2017 Apache Virtual Hosts]]
*Week 14
** DO NOT SHUTDOWN reboot without asking me first, I will be testing your apache & vhosts labs
** be sure to keep your [[Admin Log for Networking labs]] open and update it as you go
** lab instructions [[Lab Week 14 2017 Using Wireshark|https://drive.google.com/open?id=0B-CHlg81QPjfaWh1c19rS0FsOXM]] for packet sniffing
Please fill this in so I can give you marks for Week 12 & 13 https://drive.google.com/open?id=1IQdFAgS3GFRKD3Pca2dQcMAXMAur0QYkASaNxBlUjYc
*Week 15
** DO NOT SHUTDOWN reboot without asking me first, I will be testing your apache & vhosts labs
** be sure to keep your [[Admin Log for Networking labs]] open and update it as you go
** lab instructions [[Lab Week 15 2017 Packet Filtering|https://drive.google.com/drive/folders/0B-CHlg81QPjfcTcxY2xNeTNjc2c?usp=sharing]]
!Admin & Tips & Tricks
*http://www.cyberciti.biz/
*http://www.thegeekstuff.com/
!Command Line
*http://linuxcommand.org
Links to useful info for Fedora 18
/***
|''Name:''|LoadRemoteFileThroughProxy (previous LoadRemoteFileHijack)|
|''Description:''|When the TiddlyWiki file is located on the web (view over http) the content of [[SiteProxy]] tiddler is added in front of the file url. If [[SiteProxy]] does not exist "/proxy/" is added. |
|''Version:''|1.1.0|
|''Date:''|mar 17, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#LoadRemoteFileHijack|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
***/
//{{{
version.extensions.LoadRemoteFileThroughProxy = {
major: 1, minor: 1, revision: 0,
date: new Date("mar 17, 2007"),
source: "http://tiddlywiki.bidix.info/#LoadRemoteFileThroughProxy"};
if (!window.bidix) window.bidix = {}; // bidix namespace
if (!bidix.core) bidix.core = {};
bidix.core.loadRemoteFile = loadRemoteFile;
loadRemoteFile = function(url,callback,params)
{
if ((document.location.toString().substr(0,4) == "http") && (url.substr(0,4) == "http")){
url = store.getTiddlerText("SiteProxy", "/proxy/") + url;
}
return bidix.core.loadRemoteFile(url,callback,params);
}
//}}}
Welcome to the wiki for 420-241-DW Linux 2019
[[Dawson College | http://www.dawsoncollege.qc.ca]]
License [[CC:BY-NC-SA|https://creativecommons.org/licenses/by-nc-sa/3.0/]]
Any omissions, errors or attributions to pcampbell dot edu at gmail dot com
[[final exam topics 2019|https://docs.google.com/document/d/1NKCxWgt_00LSngYB-74VDyQqoP2wKqq6Ubd2IXNXaYo/edit?usp=sharing]]
@@color:red; Note:
*All labs are marked.
*I expect you to finish one lab before we start the next.
*I expect you to finish the last lab before we start the next.
*I expect you to finish the last lab before we start the next.
*I expect you to get the course notes from another student if you can't make it to class on time.
//Exceptions for illness only, but even then you cannot skip a lab.//
@@
@@color:orange; Note:
*You know this, and this should not have to be said but I expect you to submit your own work unless it is explicitly expressed that it is team work.
Plagiarism:
*submitting someone else's work as your own
*giving a copy of your work to someone else
*letting someone look at your solution
@@
@@Challenge: Find the Linux joke here http://i.imgur.com/d89Ce5D.jpg@@
We will be using Ubuntu Workstation as our distro, previous to 2019 it was Fedora Workstation (the main differences are in package management)
[[Why command line is important (from my favourite comic [[xkcd.org |http://xkcd.org]])
[img[http://imgs.xkcd.com/comics/tar.png]]
We will be using Fedora 20 as our distro
*[[assignment 2 general feedback]]
*Regex Quick Ref http://bit.ly/regex2014
*[[sample scripts]]
*[[Using sed |http://wiki.pcampbell.ep.profweb.qc.ca/index.php/Sed]]
If you have not yet done so please [[REGISTER on the edublog | THIS WEEK REGISTER on the edublog]] and notify the teacher of your userid.
Find the Linux joke here http://i.imgur.com/d89Ce5D.jpg
*https://ask.fedoraproject.org/question/3840/how-could-i-dual-boot-fedora-18-and-windows-8-on
Why command line is important:
[img[http://imgs.xkcd.com/comics/tar.png]]
[[Config stuff]]
[[News|2019 Weekly FOSS News]]
[[Labs]]
[[Install]]
[[News Sites]]
[[Misc]]
[[Slide Decks 2019|https://drive.google.com/drive/folders/1_i7dKdsBs8nlzsMO61a0Ck0H7df6B9L6?usp=sharing]]
[[bash ref]]
[[regex sed ref]]
[[bash sample scripts|https://github.com/campbe13/ScriptsSamples241]]
WhereIs
[[Wiki to PDF]]
[[Using VIM|http://wiki.pcampbell.profweb.ca/index.php/VI/VIM_editor]]
[[fun]]
[[2017]]
Fun activities for March break: real programmers can install Linux on a dead badger:
*http://www.strangehorizons.com/2004/20040405/badger.shtml
1MiB = 1024^2B = 1024*1024B
<nowiki>!= 1000^2</nowiki>
http://en.wikipedia.org/wiki/Mebibyte
See also KiB & GiB
Sysadmin
* [[Mount H: drive on linux]]
*[[Make Windows the Default startup for Dual boot| Set Windows Default boot]]
*[[Configure printing @ Dawson Labs]]
Misc
* animate gifs at cli ImageMagick: animate<br> {{{animate http://climagic\.org/images/rice-spinner.gif}}}
* [[History of Linux / Unix & Distros (with images)]]
* [[Using empathy for IM]]
* [[sample scripts]]
* [[truth table logical and/or in bash]]
* Fix on MACs VirtualBox window's won't scale https://forums.virtualbox.org/viewtopic.php?f=8&t=47945
*[[are linux passwords salted ??]]
*[[use nmap to scan the local net]]
*[[Fedora screenshots]]
*[[find broken symlinks]]
*[[Admin Log for Networking labs]] Used for labs Week 10 & up
*useful http://www.maketecheasier.com/20-run-commands-windows
*useful http://www.linuxandubuntu.com/home/basic-image-editing-with-gimp-in-linux
*Free OnLine Dictionary Of Computing [[www.foldoc.org|http://www.foldoc.org]]
To be tested http://www.server-world.info/en/note?os=Fedora_23&p=realmd for Active Directory access in labs
*April fools rick roll on github https://github.com/keroserene/rickrollrc
You will have to run this script AND test that your userid can read and write from it.
For security purposes this script must be run as root (or sudo), every time you reboot. It does not update /etc/fstab.
You can download the script from this directory [[here| https://sonic.dawsoncollege.qc.ca/~pcampbell/permanent/h-drive-script/mntH.sh]] or
You may cut and paste or download it from here or use curl or wget:
{{{
wget https://sonic.dawsoncollege.qc.ca/~pcampbell/permanent/h-drive-script/mntH.sh
}}}
Be sure to run dos2unix against it, just in case.
yum install samba-client -y
!!List drives
example: smbclient -L {{{//server/share -U ad-domain\\userid}}}
<nowiki>
smbclient -L //fileserver/home -U ad.dawsoncollege.qc.ca\\xxx
</nowiki>
!!mount drive
create mountpoint -> mkdir
<nowiki>
mount.cifs //fileserver/home /DawHome/ -o username=xxx,domain=ad.dawsoncollege.qc.ca
</nowiki>
!!one
{{{
#!/bin/bash
#pmc
#feb 22,2014
#loop, guess the letter
secret=q
guess=y
secretUP=Q
count=0
# if I don't use the " " around $guess and the user
# hits enter then I get an error
#check for lower and upper case
while [ "$secret" != "$guess" -a "$secretUP" != "$guess" ] ; do
read -p "guess the secret letter " guess
if [ "$guess" == "letmego" ] ; then
exit
fi
((count++))
echo "Guess count $count"
done
}}}
!!two
{{{
#!/bin/bash
#pmc
#feb 22,2014
# using for and arithmetic check directories
# return codes:
# 1 no cli args
scriptname=$(basename $0)
if [ $# -le 0 ] ; then
echo Usage: $scriptname 'dir1 <dir2> dir3>'
exit 1
fi
for dir
do
ctfile=0
ctsym=0
ctdir=0
if [ ! -d $dir ] ; then
echo $scriptname $dir is not a directory
continue
fi
for contents in $(ls -d $dir/*) ; do
if [ -h $contents ] ; then
echo $scriptname: $contents is a symbolic link
((ctsym++))
fi
if [ -d $contents ] ; then
echo $scriptname: $contents is a directory
((ctdir++))
elif [ -f $contents ] ; then
echo $scriptname: $contents is a file
((ctfile++))
fi
done
echo $scriptname: Your directory $dir contains:
echo $ctsym symbolic links
echo $ctfile files
echo $ctdir directories
done
}}}
!!three
{{{
#!/bin/bash
#pmc
#feb 22,2014
# using if / then / elif /else, for, here document, arithmetic
# return codes:
# 1 minimum 2 cli args
# 5 no input file name given
# 10 directory exists
# 15 error creatinge dir
scriptname=$(basename $0)
if [ $# -le 1 ] ; then
echo Usage: $scriptname '<classname> <classlist.txt>'
exit 1
fi
# I don't care about the order they
# can give me dir file or file dir
if [ -f $1 ] ; then
file=$1
dir=$2
elif [ -f $2 ] ; then
file=$2
dir=$1
else
echo "$scriptname: no file given"
exit 5
fi
if [ -d $dir ] ; then
echo "$scriptname: $dir already exists"
exit 10
fi
# error checking done
# $dir is assigned the directory name
# $file is assigned the file to be used as input
mkdir $dir
# check if it worked ok
if [ $? -gt 0 ] ; then
echo "$scriptname: error creating $dir"
exit 15
fi
ctdir=0
ctstud=$(wc -l $file|cut -f 1 -d " ")
for name in $(cat $file)
do
# I am making a design decision no error check for new dir
# could be a problem if there are duplicate names
mkdir $dir/$name
((ctdir++))
cat > $dir/$name/welcome.txt << eoWelcome
Hello $name
There are $ctstud students in the class you are number $ctdir
Welcome to the best course at Dawson College: $dir.
You will learn a lot!
Sincerely, your teacher,
Tricia
eoWelcome
echo "$scriptname directory created for $name"
done
}}}
The first widely used web server was on hoohoo.ncsa.uiuc.edu
see: (wayback)
http://web.archive.org/web/20090713225951/http://hoohoo.ncsa.illinois.edu/
*http://www.itwire.com
*http://arstechnica.com
*http://www.h-online.com/
*http://fossforce.com
*http://www.theregister.co.uk
*http://lxer.com/
*http://www.linuxjournal.com/
*http://www.linuxadvocates.com/
*http://lwn.net/
*http://www.geeklawblog.com/2013/05/geoguessr-making-game-out-of-google-maps.html
*http://opensource.com
*http://www.openculture.com/
http://quizlet.com/1993476/tiddlywiki-markup-flash-cards/
!Filesystems
http://www.tldp.org/HOWTO/Filesystems-HOWTO.html
https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout
http://e2fsprogs.sourceforge.net/ext2intro.html
/***
|''Name:''|PasswordOptionPlugin|
|''Description:''|Extends TiddlyWiki options with non encrypted password option.|
|''Version:''|1.0.2|
|''Date:''|Apr 19, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#PasswordOptionPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.PasswordOptionPlugin = {
major: 1, minor: 0, revision: 2,
date: new Date("Apr 19, 2007"),
source: 'http://tiddlywiki.bidix.info/#PasswordOptionPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
coreVersion: '2.2.0 (Beta 5)'
};
config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordInputType = "password"; // password | text
setStylesheet(".pasOptionInput {width: 11em;}\n","passwordInputTypeStyle");
merge(config.macros.option.types, {
'pas': {
elementType: "input",
valueField: "value",
eventName: "onkeyup",
className: "pasOptionInput",
typeValue: config.macros.option.passwordInputType,
create: function(place,type,opt,className,desc) {
// password field
config.macros.option.genericCreate(place,'pas',opt,className,desc);
// checkbox linked with this password "save this password on this computer"
config.macros.option.genericCreate(place,'chk','chk'+opt,className,desc);
// text savePasswordCheckboxLabel
place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
},
onChange: config.macros.option.genericOnChange
}
});
merge(config.optionHandlers['chk'], {
get: function(name) {
// is there an option linked with this chk ?
var opt = name.substr(3);
if (config.options[opt])
saveOptionCookie(opt);
return config.options[name] ? "true" : "false";
}
});
merge(config.optionHandlers, {
'pas': {
get: function(name) {
if (config.options["chk"+name]) {
return encodeCookie(config.options[name].toString());
} else {
return "";
}
},
set: function(name,value) {config.options[name] = decodeCookie(value);}
}
});
// need to reload options to load passwordOptions
loadOptionsCookie();
/*
if (!config.options['pasPassword'])
config.options['pasPassword'] = '';
merge(config.optionsDesc,{
pasPassword: "Test password"
});
*/
//}}}
ulimit command allows you to have control over resources available to the shell, it is a bash builtin so use help ulimit to see how it works
The following has the potential to crash your system so be prepared and do not run it on anything but a system over which you have complete control.
@@If you run it on sonic it can be traced back to you and this could have dire consequences to your academic career.@@
{{{
ulimit-exercise.txt
Using ulimit
1. open a terminal session
2. set ulimit to 50, the default on fedora is unlimited so you will crash
if you don't change it
3. create a script that is a resource hog:
a. creae a script file (hog.pl) and enter the following:
#!/usr/bin/perl
fork while 1
b. save the file, make it executable
This creates the binary hog which is what is called a fork bomb
it will continually create new copies of itself and by doing so
it will cause the system to grind to a halt unless the proper
limits are set.
(*do not* run the program yet, unless you want to disable your system,
*do not* run it on a production server)
4. open another terminal session
run top
5. run the program hog.pl
6. open another terminal session (can you?)
display the running processes: ps aux
then/or run the top command
7. open another terminal session
change the ulimit value higher
8. what happens to the processes ?
If a high ulimit value is set the computer will almost grind to a halt
when such a process is running. Due to this you cannot kill the
parent process so the solution is usually to reboot the system.
}}}
When you install fedora after windows Fedora is the default boot OS in grub2. In order to switch it to windows follow the instructions here
Be careful when you edit the file, if you mess it up it is //very// hard to recover.
{{{
# find the text entry for windows
grep -i windows /boot/grub/grub.cfg
# edit grub config file
# change GRUB_DEFAULT=0 to GRUB_DEFAULT="//string found in the grep//"
# save it
vi /etc/default/grub
# update grub
grub2-mkconfig -o /boot/grub2/grub.cfg
}}}
It is always a good idea to install linux after windows as windows boot loaders will not detect any linux installs. If you have problems you may need to recover or reinstall grub
*http://www.supergrubdisk.org/
*http://www.sysresccd.org/
Used in Linux I @ [[Dawson College |https://www.dawsoncollege.qc.ca/]]
@@See the teacher DURING THE LAB SESSION@@, you will be required to enter your username and email address in order to be added to the blog. This is the blog where you will submit your study notes for your assigned subject. The blog post is due the weekend before the last class.
!!Blogs
*Tuesday/Thursday http://os1section22014.edublogs.org
*Monday/Wednesday http://os1section12014.edublogs.org
If you want to print these instructions and all of the numbered links herein you may want to have it in pdf form. see [[Wiki to PDF]]
WHEN YOU DO THESE CONFIG CHANGES TEST THEM, THEY ARE NOT DONE UNTIL TESTED
Before you start launch Empathy and enter your name (Click on activities type in empathy). It will discover everyone on the network and we can use it to chat with each other.
!All of the following must be done as root user
THIS IS IMPORTANT In order to do administrative tasks on Linux you must run as root user, there are two ways to do this, we will start with using switch user, once it is configured you can use sudo.
Use switch user (see man pages for su) to run as root just for a session, enter the root password:
{{{
[tricia@pmcfedora ~]$ su -
Password:
[root@pmcfedora ~]#
}}}
Once you have switched user to root you may do the following:
Note: If at any point you are prompted to download updates click on @@Not Now@@. We don't want 30 people waiting for updates.
#[[set your hostname]]
#[[set up sshd to run]]
#[[Add userids for everyone on your team]] and userid tricia <br> Test, make sure everyone can logon, locally or using ssh.
#[[Add the team userids to sudoers file]] and tricia <br>don't forget to make sure everyone (including tricia) can use sudo<br> example: sudo tail /var/log/secure
#[[Install dos2unix/unix2dos]]
#[[install gnome tweak tool]]
#Quiet <nowiki>SELinux</nowiki> (this is a test box) [[http://bit.ly/CalmSELinux <br> This will only be activated once you reboot so to complete the step, reboot. //Be careful, if you make a typo in the file it is very difficult to fix, you may lose your work.//
#[[In 2F18 Only do this]]
#Ask Tricia if there are any other tasks to be done
#You must fill in the information sheet for your install, see [[report on the install | http://goo.gl/forms/MWnArwwzm9]]
/***
Description: Contains the stuff you need to use Tiddlyspot
Note, you also need UploadPlugin, PasswordOptionPlugin and LoadRemoteFileThroughProxy
from http://tiddlywiki.bidix.info for a complete working Tiddlyspot site.
***/
//{{{
// edit this if you are migrating sites or retrofitting an existing TW
config.tiddlyspotSiteId = 'linuxstuff';
// make it so you can by default see edit controls via http
config.options.chkHttpReadOnly = false;
window.readOnly = false; // make sure of it (for tw 2.2)
window.showBackstage = true; // show backstage too
// disable autosave in d3
if (window.location.protocol != "file:")
config.options.chkGTDLazyAutoSave = false;
// tweak shadow tiddlers to add upload button, password entry box etc
with (config.shadowTiddlers) {
SiteUrl = 'http://'+config.tiddlyspotSiteId+'.tiddlyspot.com';
SideBarOptions = SideBarOptions.replace(/(<<saveChanges>>)/,"$1<<tiddler TspotSidebar>>");
OptionsPanel = OptionsPanel.replace(/^/,"<<tiddler TspotOptions>>");
DefaultTiddlers = DefaultTiddlers.replace(/^/,"[[WelcomeToTiddlyspot]] ");
MainMenu = MainMenu.replace(/^/,"[[WelcomeToTiddlyspot]] ");
}
// create some shadow tiddler content
merge(config.shadowTiddlers,{
'TspotControls':[
"| tiddlyspot password:|<<option pasUploadPassword>>|",
"| site management:|<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . . " + config.tiddlyspotSiteId + ">>//(requires tiddlyspot password)//<br>[[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]], [[download (go offline)|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download]]|",
"| links:|[[tiddlyspot.com|http://tiddlyspot.com/]], [[FAQs|http://faq.tiddlyspot.com/]], [[blog|http://tiddlyspot.blogspot.com/]], email [[support|mailto:support@tiddlyspot.com]] & [[feedback|mailto:feedback@tiddlyspot.com]], [[donate|http://tiddlyspot.com/?page=donate]]|"
].join("\n"),
'TspotOptions':[
"tiddlyspot password:",
"<<option pasUploadPassword>>",
""
].join("\n"),
'TspotSidebar':[
"<<upload http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/store.cgi index.html . . " + config.tiddlyspotSiteId + ">><html><a href='http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/download' class='button'>download</a></html>"
].join("\n"),
'WelcomeToTiddlyspot':[
"This document is a ~TiddlyWiki from tiddlyspot.com. A ~TiddlyWiki is an electronic notebook that is great for managing todo lists, personal information, and all sorts of things.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //What now?// @@ Before you can save any changes, you need to enter your password in the form below. Then configure privacy and other site settings at your [[control panel|http://" + config.tiddlyspotSiteId + ".tiddlyspot.com/controlpanel]] (your control panel username is //" + config.tiddlyspotSiteId + "//).",
"<<tiddler TspotControls>>",
"See also GettingStarted.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Working online// @@ You can edit this ~TiddlyWiki right now, and save your changes using the \"save to web\" button in the column on the right.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Working offline// @@ A fully functioning copy of this ~TiddlyWiki can be saved onto your hard drive or USB stick. You can make changes and save them locally without being connected to the Internet. When you're ready to sync up again, just click \"upload\" and your ~TiddlyWiki will be saved back to tiddlyspot.com.",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Help!// @@ Find out more about ~TiddlyWiki at [[TiddlyWiki.com|http://tiddlywiki.com]]. Also visit [[TiddlyWiki.org|http://tiddlywiki.org]] for documentation on learning and using ~TiddlyWiki. New users are especially welcome on the [[TiddlyWiki mailing list|http://groups.google.com/group/TiddlyWiki]], which is an excellent place to ask questions and get help. If you have a tiddlyspot related problem email [[tiddlyspot support|mailto:support@tiddlyspot.com]].",
"",
"@@font-weight:bold;font-size:1.3em;color:#444; //Enjoy :)// @@ We hope you like using your tiddlyspot.com site. Please email [[feedback@tiddlyspot.com|mailto:feedback@tiddlyspot.com]] with any comments or suggestions."
].join("\n")
});
//}}}
What really works
{{{
[root@localhost ~]# vi /etc/yum/pluginconf.d/refresh-packagekit.conf
}}}
you will see
{{{
[main]
enabled=1
}}}
change enabled=1 to enabled=0
{{{
[main]
enabled=0
}}}
I would caution you to leave updates on if you have a box at home that is connecting to the internet and used as a Desktop computer.
In the labs it is different, we are treating the computers in the lab as test boxes so we will control the updates.
!!At the command line run gpk-prefs it will pop up this window, set the following
{{{
gpk-prefs
}}}
#Check for updates: Never
#Check for major upgrades: Never
[img[http://farm9.staticflickr.com/8084/8449087182_4fe432eed8.jpg]]
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 24/04/2019 18:24:00 | Tricia | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . |
| 29/04/2019 00:09:20 | YourName | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . |
| 29/04/2019 12:09:55 | YourName | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . |
| 01/05/2019 14:46:47 | Tricia | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . |
| 02/05/2019 13:07:15 | Tricia | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . |
| 13/05/2019 22:59:23 | YourName | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . | ok |
| 13/05/2019 23:00:13 | YourName | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . |
| 05/04/2020 13:45:48 | Tricia | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . |
| 05/04/2020 13:48:27 | Tricia | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . | ok |
| 05/04/2020 13:52:51 | Tricia | [[/|http://linuxstuff.tiddlyspot.com/]] | [[store.cgi|http://linuxstuff.tiddlyspot.com/store.cgi]] | . | [[index.html | http://linuxstuff.tiddlyspot.com/index.html]] | . |
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|4.1.3|
|''Date:''|Feb 24, 2008|
|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#UploadPluginDoc|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
|''Requires:''|PasswordOptionPlugin|
***/
//{{{
version.extensions.UploadPlugin = {
major: 4, minor: 1, revision: 3,
date: new Date("Feb 24, 2008"),
source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
coreVersion: '2.2.0'
};
//
// Environment
//
if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false; // true to activate both in Plugin and UploadService
//
// Upload Macro
//
config.macros.upload = {
// default values
defaultBackupDir: '', //no backup
defaultStoreScript: "store.php",
defaultToFilename: "index.html",
defaultUploadDir: ".",
authenticateUser: true // UploadService Authenticate User
};
config.macros.upload.label = {
promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
promptParamMacro: "Save and Upload this TiddlyWiki in %0",
saveLabel: "save to web",
saveToDisk: "save to disk",
uploadLabel: "upload"
};
config.macros.upload.messages = {
noStoreUrl: "No store URL in parmeters or options",
usernameOrPasswordMissing: "Username or password missing"
};
config.macros.upload.handler = function(place,macroName,params) {
if (readOnly)
return;
var label;
if (document.location.toString().substr(0,4) == "http")
label = this.label.saveLabel;
else
label = this.label.uploadLabel;
var prompt;
if (params[0]) {
prompt = this.label.promptParamMacro.toString().format([this.destFile(params[0],
(params[1] ? params[1]:bidix.basename(window.location.toString())), params[3])]);
} else {
prompt = this.label.promptOption;
}
createTiddlyButton(place, label, prompt, function() {config.macros.upload.action(params);}, null, null, this.accessKey);
};
config.macros.upload.action = function(params)
{
// for missing macro parameter set value from options
if (!params) params = {};
var storeUrl = params[0] ? params[0] : config.options.txtUploadStoreUrl;
var toFilename = params[1] ? params[1] : config.options.txtUploadFilename;
var backupDir = params[2] ? params[2] : config.options.txtUploadBackupDir;
var uploadDir = params[3] ? params[3] : config.options.txtUploadDir;
var username = params[4] ? params[4] : config.options.txtUploadUserName;
var password = config.options.pasUploadPassword; // for security reason no password as macro parameter
// for still missing parameter set default value
if ((!storeUrl) && (document.location.toString().substr(0,4) == "http"))
storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
if (storeUrl.substr(0,4) != "http")
storeUrl = bidix.dirname(document.location.toString()) +'/'+ storeUrl;
if (!toFilename)
toFilename = bidix.basename(window.location.toString());
if (!toFilename)
toFilename = config.macros.upload.defaultToFilename;
if (!uploadDir)
uploadDir = config.macros.upload.defaultUploadDir;
if (!backupDir)
backupDir = config.macros.upload.defaultBackupDir;
// report error if still missing
if (!storeUrl) {
alert(config.macros.upload.messages.noStoreUrl);
clearMessage();
return false;
}
if (config.macros.upload.authenticateUser && (!username || !password)) {
alert(config.macros.upload.messages.usernameOrPasswordMissing);
clearMessage();
return false;
}
bidix.upload.uploadChanges(false,null,storeUrl, toFilename, uploadDir, backupDir, username, password);
return false;
};
config.macros.upload.destFile = function(storeUrl, toFilename, uploadDir)
{
if (!storeUrl)
return null;
var dest = bidix.dirname(storeUrl);
if (uploadDir && uploadDir != '.')
dest = dest + '/' + uploadDir;
dest = dest + '/' + toFilename;
return dest;
};
//
// uploadOptions Macro
//
config.macros.uploadOptions = {
handler: function(place,macroName,params) {
var wizard = new Wizard();
wizard.createWizard(place,this.wizardTitle);
wizard.addStep(this.step1Title,this.step1Html);
var markList = wizard.getElement("markList");
var listWrapper = document.createElement("div");
markList.parentNode.insertBefore(listWrapper,markList);
wizard.setValue("listWrapper",listWrapper);
this.refreshOptions(listWrapper,false);
var uploadCaption;
if (document.location.toString().substr(0,4) == "http")
uploadCaption = config.macros.upload.label.saveLabel;
else
uploadCaption = config.macros.upload.label.uploadLabel;
wizard.setButtons([
{caption: uploadCaption, tooltip: config.macros.upload.label.promptOption,
onClick: config.macros.upload.action},
{caption: this.cancelButton, tooltip: this.cancelButtonPrompt, onClick: this.onCancel}
]);
},
options: [
"txtUploadUserName",
"pasUploadPassword",
"txtUploadStoreUrl",
"txtUploadDir",
"txtUploadFilename",
"txtUploadBackupDir",
"chkUploadLog",
"txtUploadLogMaxLine"
],
refreshOptions: function(listWrapper) {
var opts = [];
for(i=0; i<this.options.length; i++) {
var opt = {};
opts.push();
opt.option = "";
n = this.options[i];
opt.name = n;
opt.lowlight = !config.optionsDesc[n];
opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
opts.push(opt);
}
var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
for(n=0; n<opts.length; n++) {
var type = opts[n].name.substr(0,3);
var h = config.macros.option.types[type];
if (h && h.create) {
h.create(opts[n].colElements['option'],type,opts[n].name,opts[n].name,"no");
}
}
},
onCancel: function(e)
{
backstage.switchTab(null);
return false;
},
wizardTitle: "Upload with options",
step1Title: "These options are saved in cookies in your browser",
step1Html: "<input type='hidden' name='markList'></input><br>",
cancelButton: "Cancel",
cancelButtonPrompt: "Cancel prompt",
listViewTemplate: {
columns: [
{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
{name: 'Option', field: 'option', title: "Option", type: 'String'},
{name: 'Name', field: 'name', title: "Name", type: 'String'}
],
rowClasses: [
{className: 'lowlight', field: 'lowlight'}
]}
};
//
// upload functions
//
if (!bidix.upload) bidix.upload = {};
if (!bidix.upload.messages) bidix.upload.messages = {
//from saving
invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
backupSaved: "Backup saved",
backupFailed: "Failed to upload backup file",
rssSaved: "RSS feed uploaded",
rssFailed: "Failed to upload RSS feed file",
emptySaved: "Empty template uploaded",
emptyFailed: "Failed to upload empty template file",
mainSaved: "Main TiddlyWiki file uploaded",
mainFailed: "Failed to upload main TiddlyWiki file. Your changes have not been saved",
//specific upload
loadOriginalHttpPostError: "Can't get original file",
aboutToSaveOnHttpPost: 'About to upload on %0 ...',
storePhpNotFound: "The store script '%0' was not found."
};
bidix.upload.uploadChanges = function(onlyIfDirty,tiddlers,storeUrl,toFilename,uploadDir,backupDir,username,password)
{
var callback = function(status,uploadParams,original,url,xhr) {
if (!status) {
displayMessage(bidix.upload.messages.loadOriginalHttpPostError);
return;
}
if (bidix.debugMode)
alert(original.substr(0,500)+"\n...");
// Locate the storeArea div's
var posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
bidix.upload.uploadRss(uploadParams,original,posDiv);
};
if(onlyIfDirty && !store.isDirty())
return;
clearMessage();
// save on localdisk ?
if (document.location.toString().substr(0,4) == "file") {
var path = document.location.toString();
var localPath = getLocalPath(path);
saveChanges();
}
// get original
var uploadParams = new Array(storeUrl,toFilename,uploadDir,backupDir,username,password);
var originalPath = document.location.toString();
// If url is a directory : add index.html
if (originalPath.charAt(originalPath.length-1) == "/")
originalPath = originalPath + "index.html";
var dest = config.macros.upload.destFile(storeUrl,toFilename,uploadDir);
var log = new bidix.UploadLog();
log.startUpload(storeUrl, dest, uploadDir, backupDir);
displayMessage(bidix.upload.messages.aboutToSaveOnHttpPost.format([dest]));
if (bidix.debugMode)
alert("about to execute Http - GET on "+originalPath);
var r = doHttp("GET",originalPath,null,null,username,password,callback,uploadParams,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
bidix.upload.uploadRss = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if(status) {
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.rssSaved,bidix.dirname(url)+'/'+destfile);
bidix.upload.uploadMain(params[0],params[1],params[2]);
} else {
displayMessage(bidix.upload.messages.rssFailed);
}
};
// do uploadRss
if(config.options.chkGenerateAnRssFeed) {
var rssPath = uploadParams[1].substr(0,uploadParams[1].lastIndexOf(".")) + ".xml";
var rssUploadParams = new Array(uploadParams[0],rssPath,uploadParams[2],'',uploadParams[4],uploadParams[5]);
var rssString = generateRss();
// no UnicodeToUTF8 conversion needed when location is "file" !!!
if (document.location.toString().substr(0,4) != "file")
rssString = convertUnicodeToUTF8(rssString);
bidix.upload.httpUpload(rssUploadParams,rssString,callback,Array(uploadParams,original,posDiv));
} else {
bidix.upload.uploadMain(uploadParams,original,posDiv);
}
};
bidix.upload.uploadMain = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
var log = new bidix.UploadLog();
if(status) {
// if backupDir specified
if ((params[3]) && (responseText.indexOf("backupfile:") > -1)) {
var backupfile = responseText.substring(responseText.indexOf("backupfile:")+11,responseText.indexOf("\n", responseText.indexOf("backupfile:")));
displayMessage(bidix.upload.messages.backupSaved,bidix.dirname(url)+'/'+backupfile);
}
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.mainSaved,bidix.dirname(url)+'/'+destfile);
store.setDirty(false);
log.endUpload("ok");
} else {
alert(bidix.upload.messages.mainFailed);
displayMessage(bidix.upload.messages.mainFailed);
log.endUpload("failed");
}
};
// do uploadMain
var revised = bidix.upload.updateOriginal(original,posDiv);
bidix.upload.httpUpload(uploadParams,revised,callback,uploadParams);
};
bidix.upload.httpUpload = function(uploadParams,data,callback,params)
{
var localCallback = function(status,params,responseText,url,xhr) {
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
if (xhr.status == 404)
alert(bidix.upload.messages.storePhpNotFound.format([url]));
if ((bidix.debugMode) || (responseText.indexOf("Debug mode") >= 0 )) {
alert(responseText);
if (responseText.indexOf("Debug mode") >= 0 )
responseText = responseText.substring(responseText.indexOf("\n\n")+2);
} else if (responseText.charAt(0) != '0')
alert(responseText);
if (responseText.charAt(0) != '0')
status = null;
callback(status,params,responseText,url,xhr);
};
// do httpUpload
var boundary = "---------------------------"+"AaB03x";
var uploadFormName = "UploadPlugin";
// compose headers data
var sheader = "";
sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
sheader += uploadFormName +"\"\r\n\r\n";
sheader += "backupDir="+uploadParams[3] +
";user=" + uploadParams[4] +
";password=" + uploadParams[5] +
";uploaddir=" + uploadParams[2];
if (bidix.debugMode)
sheader += ";debug=1";
sheader += ";;\r\n";
sheader += "\r\n" + "--" + boundary + "\r\n";
sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+uploadParams[1]+"\"\r\n";
sheader += "Content-Type: text/html;charset=UTF-8" + "\r\n";
sheader += "Content-Length: " + data.length + "\r\n\r\n";
// compose trailer data
var strailer = new String();
strailer = "\r\n--" + boundary + "--\r\n";
data = sheader + data + strailer;
if (bidix.debugMode) alert("about to execute Http - POST on "+uploadParams[0]+"\n with \n"+data.substr(0,500)+ " ... ");
var r = doHttp("POST",uploadParams[0],data,"multipart/form-data; ;charset=UTF-8; boundary="+boundary,uploadParams[4],uploadParams[5],localCallback,params,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
// same as Saving's updateOriginal but without convertUnicodeToUTF8 calls
bidix.upload.updateOriginal = function(original, posDiv)
{
if (!posDiv)
posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
store.allTiddlersAsHtml() + "\n" +
original.substr(posDiv[1]);
var newSiteTitle = getPageTitle().htmlEncode();
revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
return revised;
};
//
// UploadLog
//
// config.options.chkUploadLog :
// false : no logging
// true : logging
// config.options.txtUploadLogMaxLine :
// -1 : no limit
// 0 : no Log lines but UploadLog is still in place
// n : the last n lines are only kept
// NaN : no limit (-1)
bidix.UploadLog = function() {
if (!config.options.chkUploadLog)
return; // this.tiddler = null
this.tiddler = store.getTiddler("UploadLog");
if (!this.tiddler) {
this.tiddler = new Tiddler();
this.tiddler.title = "UploadLog";
this.tiddler.text = "| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |";
this.tiddler.created = new Date();
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
}
return this;
};
bidix.UploadLog.prototype.addText = function(text) {
if (!this.tiddler)
return;
// retrieve maxLine when we need it
var maxLine = parseInt(config.options.txtUploadLogMaxLine,10);
if (isNaN(maxLine))
maxLine = -1;
// add text
if (maxLine != 0)
this.tiddler.text = this.tiddler.text + text;
// Trunck to maxLine
if (maxLine >= 0) {
var textArray = this.tiddler.text.split('\n');
if (textArray.length > maxLine + 1)
textArray.splice(1,textArray.length-1-maxLine);
this.tiddler.text = textArray.join('\n');
}
// update tiddler fields
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
// refresh and notifiy for immediate update
story.refreshTiddler(this.tiddler.title);
store.notify(this.tiddler.title, true);
};
bidix.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {
if (!this.tiddler)
return;
var now = new Date();
var text = "\n| ";
var filename = bidix.basename(document.location.toString());
if (!filename) filename = '/';
text += now.formatString("0DD/0MM/YYYY 0hh:0mm:0ss") +" | ";
text += config.options.txtUserName + " | ";
text += "[["+filename+"|"+location + "]] |";
text += " [[" + bidix.basename(storeUrl) + "|" + storeUrl + "]] | ";
text += uploadDir + " | ";
text += "[[" + bidix.basename(toFilename) + " | " +toFilename + "]] | ";
text += backupDir + " |";
this.addText(text);
};
bidix.UploadLog.prototype.endUpload = function(status) {
if (!this.tiddler)
return;
this.addText(" "+status+" |");
};
//
// Utilities
//
bidix.checkPlugin = function(plugin, major, minor, revision) {
var ext = version.extensions[plugin];
if (!
(ext &&
((ext.major > major) ||
((ext.major == major) && (ext.minor > minor)) ||
((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
// write error in PluginManager
if (pluginInfo)
pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
}
};
bidix.dirname = function(filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(0, lastpos);
} else {
return filePath.substring(0, filePath.lastIndexOf("\\"));
}
};
bidix.basename = function(filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("#")) != -1)
filePath = filePath.substring(0, lastpos);
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(lastpos + 1);
} else
return filePath.substring(filePath.lastIndexOf("\\")+1);
};
bidix.initOption = function(name,value) {
if (!config.options[name])
config.options[name] = value;
};
//
// Initializations
//
// require PasswordOptionPlugin 1.0.1 or better
bidix.checkPlugin("PasswordOptionPlugin", 1, 0, 1);
// styleSheet
setStylesheet('.txtUploadStoreUrl, .txtUploadBackupDir, .txtUploadDir {width: 22em;}',"uploadPluginStyles");
//optionsDesc
merge(config.optionsDesc,{
txtUploadStoreUrl: "Url of the UploadService script (default: store.php)",
txtUploadFilename: "Filename of the uploaded file (default: in index.html)",
txtUploadDir: "Relative Directory where to store the file (default: . (downloadService directory))",
txtUploadBackupDir: "Relative Directory where to backup the file. If empty no backup. (default: ''(empty))",
txtUploadUserName: "Upload Username",
pasUploadPassword: "Upload Password",
chkUploadLog: "do Logging in UploadLog (default: true)",
txtUploadLogMaxLine: "Maximum of lines in UploadLog (default: 10)"
});
// Options Initializations
bidix.initOption('txtUploadStoreUrl','');
bidix.initOption('txtUploadFilename','');
bidix.initOption('txtUploadDir','');
bidix.initOption('txtUploadBackupDir','');
bidix.initOption('txtUploadUserName','');
bidix.initOption('pasUploadPassword','');
bidix.initOption('chkUploadLog',true);
bidix.initOption('txtUploadLogMaxLine','10');
// Backstage
merge(config.tasks,{
uploadOptions: {text: "upload", tooltip: "Change UploadOptions and Upload", content: '<<uploadOptions>>'}
});
config.backstageTasks.push("uploadOptions");
//}}}
1. Launch the liveusb creator, click on Browse, locate the Fedora 18 iso
[img[http://farm9.staticflickr.com/8474/8427056933_e6a8320387_m.jpg]]
2. Click on create live USB
3. If it completes correctly you will see the following:
[img[http://farm9.staticflickr.com/8366/8426833495_e260692bef_m.jpg]]
4. Now you can eject your usb and verify that it boots to linux
Firewall missing permissions https://bugzilla.redhat.com/show_bug.cgi?id=844308 see Peter Oliver's post
Create the file /usr/lib/firewalld/services/presence.xml with the following content
{{{
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Serverless Messaging (presence)</short>
<description>XMPP messaging for real-time communication with users
automatically discovered over a local network. Required to receive
chats with Empathy's "People Nearby" feature, as is Multicast DNS.
This will allow this functionality for only two users per host, since
further users take random ports.
</description>
<port protocol="tcp" port="5298"/>
<port protocol="tcp" port="5299"/>
</service>
}}}
Restart your firewall
{{{
[root@pmcfedora ~] systemctl restart firewalld.service
}}}
Auto launch on login to be tested: http://linuxandfriends.com/how-to-add-startup-programs-in-gnome-3/
for Instant messaging on a LAN
The empathy client is installed by default.
It is in the launcher the icon is a talk bubble with a blue smiley face.
It is capable of detecting other other empathy users on the LAN
The following ports must be opened
{{{
TCP 5299
TCP 5298
}}}
<html>
<head>
<title>
Learning VI/VIM
</title>
<body>
<h3>
Student Instructions
</h3>
<h4>Learn VIM from a game!</h4>
Thanks to Maja for finding this game.
<a href=http://vim-adventures.com/>VIM Adventures</a>
<h4>Other resources you may want to try (Details)</h4>
The Main Website <a href=http://www.vim.org>www.vim.org</a> is for your information as is
the <b>overview</b> section below which gives a quick introduction.
<br>
You can try the <b>Tutorials</b> instructions further down on this page,
at the very least do the vimtutor.
Once you have completed that do the <b>VI Exercise</b> also further down on this page.
<h3>
Overview
</h3>
VIM is a free, improved version of the VI editor that is distributed with every UNIX system.
VIM is distributed with every linux distro.
Vim is actually distributed as charity ware.
For information on how to contribute:
<pre>
In command mode type :help iccf hit enter.
</pre>
VI/VIM ignores mouse input it is keyboard driven and operates in 3 modes:
<pre>
+-------+ +----------+ +-----------+
| input |<-- i,a,o,r,c--| command |-- : -(colon)-->| last line |
| mode |-- (escape) -->| mode |<-- (return) ---| mode |
+-------+ +----------+ +-----------+
</pre>
<i> VIM includes a fourth mode Visual mode which allows you to highlight text that is being manipulated. We will not cover that mode.</i>
<ul>
<li>
<b>Input Mode</b> all keystrokes are inserted into the text file.
<li>
<b>Command Mode</b> all keystrokes in several combinations are taken as directives to VI/VIM, lower and upper case have different meanings
<pre>
Example:
2yy (yanks the cursor/current line and the following line into the buffer)
p (pastes the contents of the buffer after the cursor/current line)
P (pastes the contents of the buffer before the cursor/current line)
cw (change the next word )
O (insert (open) a new line before the cursor/current line)
gg
G (go to end of file)
w (go forward one word)
3w (go forward 3 words)
/this (locate the string this)
5b
</pre>
<li><b>Last Line Mode</b> a single command sometimes in english words is taken as a directive to VI/VIM
<pre>
Example:
:help
:set number (line numbers on)
:set nonumber
:set rl
:syntax off
:%s/this/that/gc
</pre>
</ul>
<br>
There are two <a href=http://aec2.dawsoncollege.qc.ca/linux/intro2011/12-vim-Ch5-p175/QuickRefs/>Quick Refrences</a> in pdf format, available yzhang is one page, the other is more extensive.
If you prefer another style of quick reference check google there are a lot out there.
<br>
<br>
<h4>Mini Quick Reference</h4>
<br>
Get into command mode: <b>hit escape</b>
<br>
Get out, abandon changes: <b>:q!</B>
<br>
Get out, save changes: <b>:wq</B>
<br>
Get out, save changes: <b>:x</B>
<br>
Get out, save changes: <b>ZZ</B>
<br>
Get help: <b>:help</b>
The help file documentation is also online here <a href=http://vimdoc.sourceforge.net>vimdoc.sourceforge.net</a>
<br>
<br>
<a>Tutorials</a>
<h4>
VI/VIM Tutorials
</h4>
<pre>
1. vimtutor
At the command line type the following, hit enter and follow the instructions
vimtutor
If you get command not found after you hit enter you must first, as root(su or sudo),
install vim-enhanced:
yum install vim-enhanced
afterward run vimtutor
</pre>
I suggest you also do either 2 or 3 or both
<pre>
2. vi-muman.uk
Take a copy of vi-muman.uk from this directory into your home directory
use wget or right click & save on this <a href=http://aec2.dawsoncollege.qc.ca/linux/intro2011/12-vim-Ch5-p175/vi-muman.uk>vi-muman.uk</a>
vi-muman.uk is a quick, interactive, micro manual for new vi users.
At the command line type the following, hit enter and follow the instructions
vi -R vi-muman.uk
3.<a href=http://aec2.dawsoncollege.qc.ca/linux/intro2011/12-vim-Ch5-p175/infobound.com>infobound.com</a> copy on this website
</pre>
<h4>
VI Exercise</h4>
Once you have completed the tutorials do the <a href=http://aec2.dawsoncollege.qc.ca/linux/intro2011/12-vim-Ch5-p175/vi-exercise.html>vi exercise</a>
<h4>
Other Resources</h4>
If you want to further flex your VI/VIM muscles there are other practice/tutorials out there:
<br>
<br>
<a href=http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html>
graphical cheat sheet tutorial</a>
<br>
<a href=http://vim.wikia.com/wiki/Tutorial>
http://vim.wikia.com/wiki/Tutorial
</a>
<br>
You may also want to watch this video:<a href=http://aec2.dawsoncollege.qc.ca/linux/intro2011/12-vim-Ch5-p175/7HabitsEffectiveTextEditing.video>
7 Habits of Effective Text Editing</a>
<br>
</body>
</html>
Where do I find ...
Lecture material and textbook readings on [[moodle|https://moodle.dawsoncollege.qc.ca]] & [[S lide Decks 2019|https://drive.google.com/drive/folders/1_i7dKdsBs8nlzsMO61a0Ck0H7df6B9L6?usp=sharing]]
[[Labs]], examples, news etc. here on linuxstuff tiddlyspot wiki.
The wiki can be hard to work with, if you click on it it opens for editing. To make it easier to follow instructions mark off finished parts of labs etc. you can print the parts you want to pdf.
# Open the tiddler / lab you want
# Click on close others (only what you want to print shows)
# Right click and print to pdf,
ref: man 3 crypt http://man7.org/linux/man-pages/man3/crypt.3.html
refers to the glibc2 version of crypt, which is used to encrypt passwords on Fedora linux
as of this day 2013-04-09 Fedora 16 default install uses SHA-512 salted passwords by default
You can tell if a password in /etc/shadow is salted and the salt value by looking at the hash
if you see {{{ $6$salt$hashed-data}}} then $6$ indicates SHA-512, the data between {{{$6$}}} and the next {{{$}}} is the salt that was used the following data is the hashed password.
if you see {{{ $5$salt$hashed-data}}} then $6$ indicates SHA-256, the data between {{{$5$}}} and the next {{{$}}} is the salt that was used the following data is the hashed password.
!! definition of salt
one way hashing algorithms take data as input, for example a password, apply the algorithm to the password to create a unique hash.
salting is the addition of more data, so this uinque salt data + the password goes into the algorithm to create the hash.
this has the effect of adding more data so that a guessing program with the algorithm cannot match the hash without the salt data.
Generally well done! Marks were lost by a few of you for the following, some of it is just not following the specification.
*not submitted as a tarball
*no/minimal comments describing the script
*no/minimal comments inline
*specified names not used (log files etc)
*return codes not properly set
*log formats not valid
*did not work with absolute path, only relative
*regex not thoroughly tested (major loss of marks)
marks here http://bit.ly/Q7jGkJ
expected results for test data (valdir.log):
{{{
2014-04-25 valdir.sh: - - 0 /tmp/20060412backup
2014-04-25 valdir.sh: - - 0 /tmp/20001225backup
2014-04-25 valdir.sh: - - 0 /tmp/20010405backup
2014-04-25 valdir.sh: - - 0 20010101backup
2014-04-25 valdir.sh: - - 1 /tmp/20101244backup
2014-04-25 valdir.sh: - - 1 /tmp/20142512backup
2014-04-25 valdir.sh: - - 1 /tmp/backupbackup
2014-04-25 valdir.sh: - - 1 /tmp/20170808backup
2014-04-25 valdir.sh: - - 1 20151212backup
2014-04-25 valdir.sh: - - 1 /tmp/19991224backup
2014-04-25 valdir.sh: - - 1 /tmp/1999backup
2014-04-25 valdir.sh: - - 1 /tmp/20051225bakup
2014-04-25 valdir.sh: - - 1 /tmp/20070214backup
}}}
another test (valdir.log):
{{{
2014-04-25 valdir.sh: - - 1 x20050101backup
2014-04-25 valdir.sh: - - 1 20050101backupx
2014-04-25 valdir.sh: - - 1 /tmp/20070214back
}}}
run with export CALLER=TESTCALLER solosdir.log (validir.log):
{{{
2014-04-25 valdir.sh: -TESTCALLER - 0 20010101backup
2014-04-25 valdir.sh: -TESTCALLER - 0 /tmp/20060412backup
2014-04-25 valdir.sh: -TESTCALLER - 1 /tmp/20101244backup
2014-04-25 valdir.sh: -TESTCALLER - 1 20151212backup
}}}
expected results testData.bad, count=4 (5 if blank line counted)
{{{
P campbell 1234567 OS1
P Campbell 1234567 OS1
PCAmpbell 1234567 OSI
P CAmpbell 567 OSI
}}}
expected results testData.ok, count=2
{{{
P Campbell 1234567 OSI
P Campbell 1234567 JVI
}}}
expected valclass.log
{{{
2014-04-25 valclass.sh: - - testData ok:2 bad:4
}}}
expected valclass.log, export CALLER=TESTCALLER
{{{
2014-04-25 valclass.sh: - TESTCALLER - testData ok:2 bad:4
}}}
*http://www.maketecheasier.com/receive-android-notification-on-linux-desktop
{{{
#!/bin/bash
#pmcampbell
#2014/02/18
#use scp to backup files on sonic
# get the basename of the script (used > once)
basen=$(basename $0)
# name of the tarball we will create and upload (in /tmp)
tarball=/tmp/$(date +%F).$USER.tgz
if [ $# -le 0 ] ; then
echo "Usage: $(basename $0) \<file or list of files>"
else
tar -czf $tarball $*
if [ $? -eq 0 ] ; then
read userid -p "Enter sonic userid:"
scp $tarball $userid@sonic.dawsoncollege.qc.ca:~/$tarball
else
echo $basen: tar -czf $tarball \$\* failed
exit 5
fi
fi
}}}
Bash is only capable of showing integer arithmetic results, in order to do floating point arithmetic you must use another utility. The most commonly used utility is bc (see man bc).
!bc can be run interactively
{{{
[pcampbell@sonic 241]$ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
4*3.1415
12.5660
}}}
!bc can read from standard in
{{{
[pcampbell@sonic 241]$ echo 1/3 |bc
0
[pcampbell@sonic 241]$ echo 1/3 |bc -l
.33333333333333333333
[pcampbell@sonic 241]$ echo "(10 * 1.05) * 1.09975" |bc
11.54737
}}}
!bc can used with command substitution to assign to a variable
{{{
[pcampbell@sonic 241]$ fiveperc=$(echo "10 * 1.05" |bc)
[pcampbell@sonic 241]$ echo $fiveperc
10.50
}}}
*[[linuxcommand.org arithmetic |http://linuxcommand.org/lc3_wss0100.php]]
{{{
# bash will do arithmetic when it detects (())
echo $((125 / 5))
x=2
y=10
echo $(( x ** y))
}}}
* see also *[[linuxcommand.org arithmetic |http://linuxcommand.org/lc3_wss0100.php]]
{{{
# this code is an example of using
# command substitution $() to assign a value to a variable filect
# get a count of the files in the current directory
filect=$(ls |wc -l)
echo There are $filect files in the current directory
}}}
{{{
# declare the function
# must be declared before it is referenced
toupper () {
# uses global variables (this is a design decision)
# lowerData as input
# upperData as output
# make sure lowerData contains something
if [ "$lowerData" != "" ] ;then
upperData=$(echo $lowerData |tr [:lower:] [:upper:])
else
return 1
fi
# if I get here
# status returned is the status of the last statement executed
}
# using the function
lowerData=abc
toupper
#in toupper the return or the last statement set the status code
if [ $? -eq 0 ] ; then
echo $lowerData
echo $upperData
else
echo "problem with toupper function"
fi
}}}
!ref: http://tldp.org/LDP/abs/html/complexfunct.html
!!Declare functions, declared before they are called (interpreter must see them to use them)
!!!One way to declare a function
{{{
function functionName {
}
}}}
!!!Second (my preferred) way to declare a function
{{{
functionName () {
}
}}}
!!Calling functions
!!!Without arguments
functionName
{{{# after function call status / return codes in $?}}}
{{{
functionName () {
# vars can be global in scope
# set elsewhere and used or modified in the function
if [ "$var1" == "M" ] ; then
echo "m is bad, it is an error"
return 1
fi
# set in the function and used or modified here or elsewhere
var2="I can see this in the main body of code"
#otherwise it is ok
# If I don't put an explicit return code it
# is the return code of the last statement executed
return 0
}
}}}
!!!!call
{{{
functionName2
# after function call status / return codes in $?
}}}
!!!With arguments
!!!!must be declared before it is called
{{{
functionName2 () {
# the arguments to a function are treated like cli args
echo count of function args $#
echo "arg 1 is $1 "
echo "arg 1 is $2 "
echo "etc"
# If I don't put an explicit return code it
# is the return code of the last statement executed
return 0
}
}}}
!!!!call
{{{
functionName2 arg1 arg2 arg3
# after function call status / return codes in $?
}}}
!!!With local and global variables http://tldp.org/LDP/abs/html/localvar.html
{{{
functionName3 () {
local lvar=10
gvar2=25
echo functionName3: \$gvar $gvar
echo functionName3: \$gvar2 $gvar2
echo functionName3: \$lvar $lvar
}
sname=$(basename $0)
echo $sname: before func not set \$gvar2 $gvar2
echo $sname: before func not set \$lvar $lvar
functionName3
gvar=15
gvar2=35
functionName3
echo $sname: after func set \$gvar2 $gvar2
echo $sname: after func not set \$lvar $lvar
}}}
!!!As the condition in an if statement
{{{
ffunc () {
return 1 # anything but zero is false
}
tfunc () {
return 0 # zero is true
}
if tfunc ; then
echo true tfunc
else
echo false tfunc
fi
if ffunc ; then
echo true ffunc
else
echo false ffunc
fi
}}}
*See my [[Quick Reference|https://docs.google.com/document/d/1P6YXqTiwriZahY9JoayhfhpsmbCXPA517pua0aKl1SY/edit?usp=sharing]]
*My examples below and [[here | http://bit.ly/bash241]]
*See your TextBook Chapter 27
*See [[Advanced Bash Scripting Guide | http://tldp.org/LDP/abs/html/index.html]]
[[bash and integer arithmetic]]
[[bash command substitution]]
[[bash using case examples]]
[[bash functions]]
[[bash function toupper]]
*<nowiki>[[</nowiki> (double square braces) versus <nowiki>[</nowiki> (single square braces) in bash http://mywiki.wooledge.org/BashFAQ/031
[[xdialog]] for fancy input
[[ twitter account cli magic |https://twitter.com/climagic ]]
!fun weird stuff & extras (not in the sylabus)
[[script to create chroot jail]]
[[Arrays in bash]]
[[bash and floating point arithmetic]]
[[IFS in bash]]
[[read file with while]]
!case.sh
{{{
#!/bin/bash
#pmc
#march 5, 2014
# case examples
# script case.sh
read -p "gimme " var
echo \$var is $var
case $var in
abc|a|A) echo "you selected A/a or abc"
echo "thanks"
;;
[bB]) echo "you selected B/b "
echo "thanks"
;;
[Kk]*) echo "you selected k/Ksomething "
echo "thanks"
;;
[0-9]) echo 'you entered a number <10 ' ;;
[0-9][0-9]) echo 'you entered a number >10 <100 ' ;;
*) echo "I do not know what that is " ;;
esac
}}}
!menu.sh
{{{
#!/bin/bash
#pmc
#march 5, 2014
# case menu examples
# script: menu.sh
while [ "$var" != "q" ] ; do
read -p "ls = l, date = d, p = pwd, q = quit " var
#echo \$var is $var
echo "you selected $var"
case $var in
l|L|ls) ls ;;
d|D|date) date ;;
p|P|pwd) pwd ;;
q|Q|quit*) var=q ;; # end the program outer while
*) echo "try again" ;;
esac
done
}}}
{{{ find . -type l -! -exec test -e {} \; -print }}}
{{{
#!/bin/bash
# pmcampbell
# Jan 2016
# 2f16 lab only
# workaround for the installer bug in Fedora 23
usage = "$(basename $0) fix anaconda, must run as root
if [[ $(whoami) != "root" ]] ; then
echo $usage
return 1
fi
cd /usr/lib64/python3.4/site-packages/pyanaconda
rm nm.py
wget https://raw.githubusercontent.com/jkonecny12/anaconda/b7ac7a7b2aff152a9aca0d888dc91bfc381b5c53/pyanaconda/nm.py
}}}
cli fun
*http://sshtron.zachlatta.com/ ssh in and play tron (vim bindings, no arrow keys)
*http://blinkenlights.nl/services.htm
**telnet towel.blinkenlights.nl (star wars)
**telnet towel.blinkenlights.nl 666 (BOFH excuses)
Good overview of network i/o:
*https://medium.com/git-checkout-b-idk-what-im-doing/protocol-andia-welcome-to-the-networking-neighborhood-aab3f0fa3bf
{{{
# bash return codes (functions return, scripts exit)
# simple functions, only return a value
f5000 () {
return 5000
}
f256 () {
return 256
}
f255 () {
return 255
}
f150 () {
return 150
}
f-5 () {
return $((-5))
}
# won't work
f5000
echo f5000 returns $?
# won't work
f256
echo f256 returns $?
# works
f255
echo f255 returns $?
# works
f150
echo f150 returns $?
# error message really won't work
f-5
echo f-5 returns $?
}}}
{{{
#!/bin/bash
#pmc
# march 10, 2014
# useful functions
sn=$(basename $0)
###source ./functionsonly.sh
# to use this function:
# filesizeb <filename>
# get file size in bytes in fsize
# file name is argument to function
# file size is set in global var fsize
# return 0 - everything a-ok
# return 1 - no cli args
filesizeb () {
if [ $# -eq 0 ] ; then
fsize=0
return 1
fi
fsize=$(du -b $1 |cut -f 1)
}
# to use this function:
# usage $*
# script needs 2 cmd line args, both must be files
# return 0 - everything a-ok
# return 1 - no cli args
# return 5 - root running script
# return 10 - cli args not files
usage () {
if [ $# -ne 2 ] ; then
echo Usage: $sn file1 file2
return 1
fi
if [ "$USER" == "root" ] ; then
echo $sn: root shall not pass
return 5
fi
for fn ; do
if [ -f $fn ] ; then
continue
else
echo Usage: $sn file1 file2 must be files
return 10
fi
done
return 0 # ret code of last command if not here
}
##main code
usage $*
case $? in
1) echo "exit with 1"
exit;;
5) echo "exit with 5" ; exit;;
10) echo "exit with 10" ; exit;;
*) echo "its ok";;
esac
# everything is ok here
filesizeb $1
echo $1 size $fsize
filesizeb $2
echo $2 size $fsize
}}}
{{{
#!/bin/bash
#pmc
# march 10, 2014
# functions and variable scope
sn=$(basename $0)
func1 () {
gvar=10
local lvar=5
local lvar2=test
echo $FUNCNAME: \$gvar2 $gvar2
echo $FUNCNAME: \$lvar $lvar
echo $FUNCNAME: \$lvar2 $lvar2
gvar2=tuv
} # func1()
lvar2=squid
gvar2=xyz
echo $sn: \$gvar2 $gvar2
echo $sn: \$gvar $gvar
echo $sn: \$lvar $lvar
echo $sn: \$lvar2 $lvar2
func1
echo $sn: \$gvar2 $gvar2
echo $sn: \$gvar $gvar
echo $sn: \$lvar $lvar
echo $sn: \$lvar2 $lvar2
}}}
Fedora 23 uses the latest version of Gnome desktop environment 2.18. To change its settings you can install the Gnome Tweek tool, it allows you to change
*appearance
*desktop decoration
*top bar
*workspaces
*windows
As root, run the following command:
{{{
yum install gnome-tweak-tool
}}}
!Use the man pages to see what each of these options actually do.
Short link to this tiddler: http://is.gd/mRnM1l
!!We are going to use filtering to block incoming packets
1. Check to see if there are any existing iptables rules for the filter table
{{{ iptables -L }}}
2. if there are any flush them all:
{{{ iptables -F }}}
3. make sure it flushed the tables, see what the filter table looks like now:
{{{ iptables -v -nL}}}
The Chains and headers should show but no rules
You should see:
{{{
Chain INPUT (policy ACCEPT x packets, x bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT x packets, x bytes)
pkts bytes target prot opt in out source destination
etc
}}}
4. ping the loopback device, it should respond
{{{ ping localhost -c 4 }}}
5. add a rule to DROP any icmp packed received for the loopback device
{{{ iptables -A INPUT -d 127.0.0.1 -p icmp -j DROP }}}
>What this does:
>>Append to the (built in) INPUT chain of the filter table the rule:
>>for all incoming packets going to destination (-d) 127.0.0.1
>>for protocol (-p) ICMP
>>jump (-j) to the DROP chain
6. See what the filter table looks like
{{{ iptables -v -nL }}}
You should see:
{{{
Chain INPUT (policy ACCEPT x packets, x bytes)
pkts bytes target prot opt in out source destination
0 0 DROP icmp -- * * 0.0.0.0/0 127.0.0.1
etc
}}}
Note //instead of source (-s 127.0.0.1)// you could do the same thing by interface (-i lo) or source (-s 127.0.0.1 )
7. ping the loopback device what happens ?
{{{ ping localhost -c 4 }}}
Why do you get 100% packet loss?
8. Flush the rule from step 5 and instead of DROP use REJECT, repeat steps 6 & 7 what happens? Is anything different?
9. Flush the rule from step 8. Now add a rule to DROP all ICMP to any interface on your box. See step #5 and man page for iptables. Hint: you don't care about source and destination think protocol.
10. ping your ip, have your neighbour ping your ip, what happens?
11. Now add a rule to DROP all traffic coming from your neighbour. See step #5 and man page for iptables (hint you will need your neighbour's //source// IP)
12. have your neighbour try to ssh, or ftp, or wget to your box, what happens?
[[Lab Script (week 5)]]
[[Lab Script (week 6)]]
[[Lab Script (week 7)]]
[[Lab Script (week 8)]]
[[Lab Script (week 9)]]
[[Lab (week 10)]]
check out Julia's comic & zines for Linux class https://wizardzines.com/
ask Jaya if I should ask her about speaking ???
week 2 - lecture 2
* syllabus overview
week 1 - lecture 1
*attendance
*syllabus
*slides os concepts 1
*where is ?? linuxstuff/moodle/
** some of you have not logged onto moodle, the first time you have to give it an email address and have it verified, do so in the lab
**teacher contact link & MIO & f2f
week 1 - lab 1
*put linuxstuff url on the board
*quiz, here, point out we will be marking/reviewing this quiz
week 1 - lecture 2
*slides os concepts 2
*slides unix/linux history
*news
0100 0111 0100 1111 0010 0000 0100 1000 0100 0001 0100 0010 0101 0011 0010 0001
see mini web server
if you do this on two computers make sure the port is open
!small file date
!!computer/terminal 1 (server)
{{{
tricia@ubbie:~$ sudo nc -l -p 4545 > outfile.txt
tricia@ubbie:~$ cat outfile.txt
Fri Oct 21 22:16:30 EDT 2016
tricia@ubbie:~$
}}}
!!computer/terminal 2 (client)
{{{
tricia@ubbie:~$ echo $(date) |nc -w 3 localhost 4545
}}}
using netcat (nc) or other tools you can read & write to sockets (UDP or TCP) So with this you can create your own mini server:
The looping idea is from @emilyst on twitter
Open 2 terminals
!Terminal 1 (server)
Create 2 files server.sh & response.txt, run server.sh it will launch your mini webserver.
!!response.txt:
{{{
tricia@ubbie:~/mini-webserver$ cat response.txt
HTTP/1.1 200 OK
<html> hi welcome to my world </html>
}}}
!!server.sh
{{{
tricia@ubbie:~/mini-webserver$ cat server.sh
#!/bin/bash
# mini web server
# see response.txt
while true ; do
sudo nc -l 80 < response.txt;
done
}}}
!Terminal 2 (connect to your server)
1 curl localhost
{{{
tricia@ubbie:~/mini-webserver$ curl localhost
<html> hi welcome to my world </html>
}}}
2. wget localhost
{{{
tricia@ubbie:~/mini-webserver$ wget localhost
--2016-10-21 21:51:14-- http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified
Saving to: ‘index.html’
index.html [ <=> ] 38 --.-KB/s in 0s
2016-10-21 21:51:14 (7.50 MB/s) - ‘index.html’ saved [38]
tricia@ubbie:~/mini-webserver$ cat index.html
<html> hi welcome to my world </html>
}}}
3. try it in a browser
telnet towel.blinkenlights.nl & website
http://www.linuxbsdos.com/2013/07/07/4-third-party-repositories-to-enable-on-fedora-19/
sudo yum install minitube
see [[my solution to lab week 8 phase 2]] for regex to check for numbers
!! check for 2 characters lower case func2charregex.sh
{{{
#!/bin/bash
# pmc
# 2013-04-02
# 2 lower case letters in regex in bash
func ()
{
if [[ "$1" =~ "^[a-z]{2}$" ]]
then
echo " two lower case letters"
return 0
else
echo " not 2 lower case letters"
return 1
fi
}
for i in uu AA 9a a9 99 aa99 99aa 99aa99
do
func $i
echo '$i ' $i '$? ' $?
done
}}}
!! check for blank delimited words
{{{
#!/bin/bash
# pmc
# 2013-04-02
# using blank delimited words in regex in bash
pat=" lines "
if [[ "this string contains lines " =~ $pat ]] ; then
echo match
else
echo no match
fi
pat="[[:blank:]]lines[[:blank:]]"
if [[ "this string contains lines " =~ $pat ]] ; then
echo match
else
echo no match
fi
if [[ "this string containslines " =~ $pat ]] ; then
echo match
else
echo no match
fi
}}}
!!script checknum.sh
{{{
#!/bin/bash
# pmc
# march 2014
# check if cli is numeric or not
# here I am sourcing (dot) the file (funcs.sh.inc)
# this is equivalent to the java import
# it makes the code in funcs.sh.inc part of the current process
. funcs.sh.inc
read -p "number or quit " num
while [[ ! $num =~ ^[qQ] ]] ; do
isnumeric $num
if [ $? -eq 0 ] ; then
echo $num is a number
else
echo $num aint no number
fi
isnumericneg $num
if [ $? -eq 0 ] ; then
echo $num is a number
else
echo $num aint no number
fi
isnumericplus $num
if [ $? -eq 0 ] ; then
echo $num is a number
else
echo $num aint no number
fi
read -p "number or quit " num
done
}}}
!!functions funcs.sh.inc
{{{
# in here I use the posix character classes
# [[:digit:]] has exactly the same result as [0-9]
# [^[:digit:]] has exactly the same result as [^0-9]
isnumeric () {
if [ $# -ne 1 ] ; then
return 1
fi
echo ' [[ "$1" =~ ^[[:digit:]]*$ ]] '
if [[ "$1" =~ ^[[:digit:]]*$ ]] ; then
return 0
else
return 1
fi
} #isnumeric()
isnumericneg () {
if [ $# -ne 1 ] ; then
return 1
fi
echo ' [[ "$1" =~ [^[:digit:]] ]] '
if [[ "$1" =~ [^[:digit:]] ]] ; then
return 1
else
return 0
fi
} #isnumericneg()
isnumericplus () {
if [ $# -ne 1 ] ; then
return 1
fi
echo '[[ "$1" =~ ^[[:digit:]]+$ ]]'
if [[ "$1" =~ ^[[:digit:]]+$ ]] ; then
return 0
else
return 1
fi
} #isnumericplus()
}}}
Replace some bash with python?
http://www.linuxjournal.com/content/python-scripts-replacement-bash-utility-scripts
http://magazine.redhat.com/2008/02/07/python-for-bash-scripters-a-well-kept-secret/
ssh timeout possibly happening
http://superuser.com/questions/98562/way-to-avoid-ssh-connection-timeout-freezing-of-terminal-tab
If you want to read the lines of a file into a bash script in order to include blank lines (ex just a carriage return) you must use while as follows
I have a file named myfile with the following contents. Line 3 has two spaces on it, line 4 has a carriage return.
{{{
This is line 1 in the file
Now this is line 2 in the file
The previous line was blank
}}}
code
{{{
while read line
do
((count++))
# regex for blank lines
# ^$
# ^[[:space:]]$
if [[ $line =~ ^$ ]] ; then
echo $count: blank line
else
echo $count: $line
fi
done < myfile
}}}
result
{{{
1: This is line 1 in the file
2: Now this is line 2 in the file
3: blank line
4: blank line
5: The previous line was blank
}}}
!!test.sh
{{{
#!/bin/bash
# pmc
# some regex ... reading a file
# 2014-04-16
count=0
#discovered bash trims leading and trailing spaces when
#reading lines this way so check for
#[[:space:]]$ or ^[[:space:]] will not match anything but
#empty lines
while read line
do
((count++))
#echo LINE: $line
if [[ $line =~ Linux$ ]] ; then
echo $count matches Linux$ LINE: $line
fi
if [[ $line =~ ^The ]] ; then
echo $count matches ^The LINE: $line
fi
if [[ $line =~ [0-9] ]] ; then
echo $count matches [0-9] LINE: $line
fi
if [[ $line =~ [^a-zA-Z][0-9] ]] ; then
echo $count matches [^a-zA-Z][0-9] LINE: $line
fi
if [[ $line =~ ^[[:digit:]]+$ ]] ; then
echo $count matches ^[[:digit:]]+$ LINE: $line
fi
if [[ $line =~ ^[0-9]+$ ]] ; then
echo $count matches ^[0-9]*$ LINE: $line
fi
if [[ $line =~ ^[^[:digit:]]+$ ]] ; then
echo $count matches ^[^[:digit:]]+$ LINE: $line
fi
# this works too but simpler in one regex
#if [[ $line =~ [Ww]indows ]] || [[ $line =~ [Ll]inux ]] ; then
if [[ $line =~ ([Ww]indows|[Ll]inux) ]] ; then
echo $count matches '([Ww]indows|[Ll]inux)' LINE: $line
fi
if [[ $line =~ thing{2,5}[[:space:]] ]] ; then
echo $count matches 'thing{2,5}' LINE: $line
fi
if [[ $line =~ thing{2,5}[^g] ]] ; then
echo $count matches 'thing{2,5}' LINE: $line
fi
if [[ $line =~ ^Li.*ux$ ]] ; then
echo $count matches '^Li.*ux$' LINE: $line
fi
if [[ $line =~ (tricia|root) ]] ; then
echo $count matches '(tricia|root)' LINE: $line
fi
if [[ $line =~ ^[^[:space:]]*$ ]] ; then
echo $count matches '^[^[:space:]]*$' LINE: $line
fi
if [[ $line =~ ^[^[:space:]]+$ ]] ; then
echo $count matches '^[^[:space:]]+$' LINE: $line
fi
if [[ $line =~ [^[:space:]]+ ]] ; then
echo $count matches 'XXXXXX[^[:space:]]+' LINE: $line
fi
if [[ $line =~ [^[:space:]]* ]] ; then
echo $count matches 'YYYY[^[:space:]]*' LINE: $line
fi
if [[ $line =~ [^[:space:]]? ]] ; then
echo $count matches 'ZZZ[^[:space:]]?' LINE: $line
fi
if [[ "$line" =~ ^[^[:space:]]+ ]] ; then
echo $count matches 'AAA^[^[:space:]]+' LINE: $line
fi
if [[ "$line" =~ [[:space:]]$ ]] ; then
echo $count matches 'BBB[[:space:]]$' LINE: $line
fi
echo x$line x
done < list
}}}
!!list
{{{
LInux is great this won't match
Linux is great this will match ends with Linux
The sentence will match begins with The
098219832843287540875487
Windows is not Linux but linux is not windows
thing tricia
thinggg cat runn windows
thingggggg 3 ns
thin no ns
thingggg 4 ns
Linux is great this will match as long as i have at the end Unux
tricia has root access
This begins with a space but bash trims it so use egrep to try
Liux
Lix
Linux is kdsjf;lkfdsj jfd;jdf dsjf;dsjf kjdsfkjsd;f ;kjdfkjdsf j;jfdsj fjsdlkfj;lsadjf ;lsad f;lkdsajf;lksadjf sd;f dsf root dsdsafadsfdsfux
nospacesanywherethisishardtoreadisitnot?
~
}}}
!anchors
!!matching
{{{
egrep Linux* list2
egrep [Ll]inux* list2
egrep [Ll]inux* list2
egrep $[Ll]inux* list2
egrep ^[Ll]inux* list2
egrep [Ll]inux* list2
egrep [Ll]inux*$ list2
egrep ^[Ll]inux* list2
egrep ^[Ll]inux+$ list2
}}}
!!list2
{{{
Linu
Linux
Linuxxxxxxx
linuabc
linuxabc
linuxxxxanything
Linuabc
Linuxabc
Linuxxxxanything
abcLinuabc
xefLinuxabc
sdfLinuxxxxanything
dsakfjLinu
sadfLinux
sadfLinuxxxxxxx
}}}
!regex
*Course notes
*My examples (bash) https://github.com/campbe13/ScriptsSamples241/tree/master/09-regex-bash
*Appendix A of your book
*Quick Ref http://bit.ly/regex2014
*http://www.zytrax.com/tech/web/regex.htm (up to and including POSIX)
*http://www.regular-expressions.info/
*Regex in 55 min http://qntm.org/files/re/re.html
!!practice
*http://regexone.com/lesson/1
!!This is pretty cool but it uses sed syntax, shortcuts and capture groups () which we only cover for //or// (unix|windoze) and it does not support posix so if it is confusing, skip it.
*http://www.regexr.com/ but it's pretty cool...
!sed
*My overview http://wiki.pcampbell.ep.profweb.qc.ca/index.php/Sed
*My examples (sed) https://github.com/campbe13/ScriptsSamples241/tree/master/10-regex-sed
*Tutorial http://www.grymoire.com/Unix/Sed.html
*http://tldp.org/LDP/Bash-Beginners-Guide/html/chap_05.html
*http://www.maketecheasier.com/beginners-guide-to-sed-linux/
*http://www.tldp.org/LDP/abs/html/x23170.html
!awk
*Tutorial http://www.grymoire.com/Unix/Awk.html
You can copy paste these strings to test your script. You may want to download them to your computer.
!!list1
{{{
Linu
Linux
Linuxxxxxxx
linuabc
linuxabc
linuxxxxanything
Linuabc
Linuxabc
Linuxxxxanything
abcLinuabc
xefLinuxabc
sdfLinuxxxxanything
dsakfjLinu
sadfLinux
sadfLinuxxxxxxx
}}}
!!list2
{{{
LInux is great this won't match
Linux is great this will match ends with Linux
The sentence will match begins with The
098219832843287540875487
Windows is not Linux but linux is not windows
run tricia
runn cat runn windows
runnn 3 ns
ru no ns
runnnn 4 ns
Linux is great this will match as long as i have at the end Unux
tricia has root access
This begins with a space but bash trims it so use egrep to try
Liux
Lix
Linux is kdsjf;lkfdsj jfd;jdf dsjf;dsjf kjdsfkjsd;f ;kjdfkjdsf j;jfdsj fjsdlkfj;lsadjf ;lsad f;lkdsajf;lksadjf sd;f dsf root dsdsafadsfdsfux
nospacesanywherethisishardtoreadisitnot?
~
}}}
!a lot of samples are here in this tarball http://aec2.dawsoncollege.qc.ca/linux/intro2011/2011-all-bash-scripts.tgz
! misc examples
{{{
# countdown
count=10
while [ $count -ge 0 ]
do
echo $count
((count--))
done
}}}
!Week 8
[[functions and return codes]] and [[starting regex]]
!Week 9
[[more regex]] and [[sed]]
What is a chroot jail? It is when you confine a user or a process to a part of the directory tree, you change the root to appear to be within the directory tree.
chroot
This script will create a chroot jail and ensure that both bash and ls are available.
{{{
#!/bin/bash
# mk chroot jail put ls in it
# mkjail.sh
if [ $(whoami) != "root" ]
then
echo " root only "
exit
fi
mkdir -p /chrootjail/bin
mkdir -p /chrootjail/lib64
#copy in bash & ls
ln /bin/bash /chrootjail/bin/bash
ln /bin/ls /chrootjail/bin/ls
# get the shared objects
for ii in /bin/ls /bin/bash
do
for i in $(ldd $ii |cut -d " " -f 3 |grep / )
do
cp $i /chrootjail/lib64/
done
for i in $(ldd $ii |cut -d " " -f 1 |grep / )
do
cp $i /chrootjail/lib64/
done
done
touch /chrootjail/jail.created.$(date +%F-$H-%M)
}}}
see also here:
http://how-to.linuxcareer.com/how-to-automatically-chroot-jail-selected-ssh-user-logins#h2-creating-basic-chroot-environment
Section 1 lab results here:
https://docs.google.com/spreadsheets/d/1mKcgw5YPI00FqWilAnnyP9TQ4nhRz8z6PQfm5naOhCk/edit?usp=sharing
Section 2 lab results here:
https://docs.google.com/spreadsheets/d/1-NKhaXts5Bbv2lXW0nRYfXu_991Il6X8ECiqEvIkhT8/edit?usp=sharing
!References:
*[[regex sed ref]]
!!How to use sed
{{{
# instruction inline locate string this and print the matching line
# -n is silent (don't print as you scan, print only match, try it without the -n)
sed -n /this/p file
# instruction(s) in scriptfile
sed -nf scriptfile file
}}}
{{{
#scriptfile
/this/ p
}}}
!!!sed basic versus extended regex
{{{
# sed defaults to using basic regex, some of the regex you have
# seen are extended regex, to force sed to understand them
# you must use the following syntax
sed -nr "/thing{2,3}/p " file
}}}
!!Exercise
Do the following matching using sed write a regex for each one then run it against the file to print the match as follows (they are case sensitive):
# ends with: Linux
# begins with: Linux
# contains the string unix
# begins with an upper case letter
# does not contain a number (0-9) anywhere
# contains Windows or Linux or windows or linux
# contains thingg (with minimum 2 g maximum 5 g on the end)
# does not contain any whitespace
# contains Linux (with 0 or more x on the end)
# contains the word Tux (preceded and followed by blank)
n.b. for the //does not contain// you need to play around with anchors
Since it is sed, you can put all of your strings into a file and use the file as input to your sed commmands. Here is the text for the file:
{{{
Linux is 100% unix and more Linux
windows proprietary sucks
Windows is cludgingg
windows is nothingggggg
notahintofwhitespaceherer!!!!ha
you won't find Tux using Windows
Likely things are in flux
123456789101112
Windows aint linu
this line will match if we search for this
}}}
!Part 3 (Optional)
For those who are interested, I have a series of exercises using sed and gawk, ask me.
The following commands make sure that sshd is running and will come up when you reboot the machine
@@systemctl@@ ends in l (ell) not 1 (one)
{{{
[root@pmcfedora ~]# systemctl enable sshd.service
[root@pmcfedora ~]# systemctl start sshd.service
}}}
Test to see if it is running
{{{
[root@teacherz ~]# ps aux |grep sshd
root 3284 0.0 0.0 80760 3528 ? Ss 20:33 0:00 /usr/sbin/sshd -D
}}}
Find out the ipv4 address of your computer, your interface is (enp0s25 in 2f16) p128p1 in 2f.18, so the ip address for this computer is 10.172.15.13
{{{
[root@teacherz ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 8 bytes 692 (692.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 692 (692.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
p128p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.172.15.13 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::a6ba:dbff:fefb:9967 prefixlen 64 scopeid 0x20<link>
ether a4:ba:db:fb:99:67 txqueuelen 1000 (Ethernet)
RX packets 237011 bytes 280313036 (267.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 109074 bytes 8726584 (8.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16
}}}
!!!Test from a Windows computer:
load secure shell or putty, type in the ip address and login using one of your team's userids. You should end up with a terminal session similar to the way you have been using sonic.
!!!Test from another linux box:
open a terminal session, use one of your userids:
{{{ssh finney@10.172.15.13 }}} Once you enter the password you should end up with a terminal session similar to the way you have been using sonic.
Your prompt will always show localhost if you do not configure your host name. Your domain name will be dawsoncollege.qc.ca
YOUR HOST+DOMAIN MUST BE UNIQUE, DO NOT USE THE SAME AS YOUR NEIGHBOUR
#Decide amongst your team what you want to call your computer, check here for the restrictions http://www.utexas.edu/its/help/utnic/847 You have a choice for the host name component only, the domain name is dawsoncollege.qc.ca
#Edit /etc/hostname, <br>replace localhost.locadomain with <your choice>.dawsoncollege.qc.ca<br>save the file
#To activate it reload networking
@@systemctl@@ ends in l (ell) not 1 (one)
{{{
systemctl restart network.service
}}}
you may get an error {{{Job for network.service failed...}}} but it actually works
!!!Testing
open a new terminal, you will see the new prompt, type hostname it will return your full name
The following will use yum rpm and repositories to install the nano editor. It is to enable you to use it as your editor for the other tasks.
{{{
yum -y install nano
}}}
once this completes you can use nano as your editor for the other tasks in the list.
basic regex (plus * modifier)
{{{
#!/bin/bash
#pmc
#march 13, 2014
# regex examples (we shall see)
str=i
# exit with q/Q/Quit etc
until [[ $str =~ ^[qQ] ]] ; do
read -p " string ? " str
# string compare aeiou
if [ "$str" == aeiou ] ; then
echo $str: strcomp vowels, in order
else
echo $str: strcomp not vowels in order
fi
# check for pattern aeiou within str
if [[ $str =~ [aeiou] ]] ; then
echo $str: contains a vowel
else
echo $str: contains no vowels
fi
# check if ONLY 3 letter word beginning w b ending in t
#if [[ $str =~ ^b.t$ ]] ; then
# check if ONLY 3 ltr word, really a word, beg w b end in t
# if [[ $str =~ ^b[aeiou]t$ ]] ; then
# check if anywhere 3 ltr word, really a word, beg w b end in t
#if [[ $str =~ b[aeiou]t ]] ; then
# check if anywhere any size word beg w b and ending in t
# . (dot) any character
# * modifier to previous caracter 0 or more of previous character
# .* (zero or more of any character)
#if [[ $str =~ b.*t ]] ; then
# check if anywhere any size word beg w b and ending in t
if [[ $str =~ ba*t ]] ; then
echo $str: anywhere 3 letter REAL word beg w b end in t
else
echo $str: nope
fi
done
}}}
useradmin
{{{
ssh <station number>
curl http://sonic.dawsoncollege.qc.ca/~pcampbell/testg.sh > testg.sh
run it w station number as arg
}}}
logical and in bash is -a within single square braces
| p | q | p -a q |
|T|T|T|
|T|F|F|
|F|T|F|
|F|F|F|
logical or in bash is -o within single square braces
| p | q | p -o q |
|T|T|T|
|T|F|T|
|F|T|T|
|F|F|F|
nmap -F 10.172.0.0/16 # -F fast limited port scan
At the command line type the following, hit enter and follow the instructions that vimtutor gives you.
{{{
vimtutor
}}}
If you get command not found after you hit enter you must first, as root(sudo),
install vim-enhanced, then run vimtutor
{{{
yum install vim-enhanced
}}}
{{{
#!/bin/bash
# p campbell
# feb 26, 2014
# script from lab 6 warmup
# use a command line arg expect a file
# return codes used by this script
# 1 = missing arg(s)
# 5 = arg is not a file
# 10 = root is trying to run the script
# check for command line args
if [ $# -lt 1 ] ; then
echo $0 you must give me a file name
exit 1
fi
# check that it is a file
if [ ! -f $1 ] ; then
echo $0 $1 is not a file
exit 5
fi
# don't let root run this
if [ $(whoami) == root ] ; then
echo $0 root shall not pass
exit 10
fi
# logic here
filesz=$(du -b $1|cut -f 1 )
#echo $filesz
if [ $filesz -lt 1024 ] ; then
echo $1 is $filesz \< 1KB
elif [ $filesz -lt $(( 2 ** 20 )) ] ; then
echo $1 is $filesz \< 1MB
elif [ $filesz -lt $(( 2 ** 30 )) ] ; then
echo $1 is $filesz \< 1GB
else
echo $1 is $filesz one big honkin file
fi
}}}
I was asked about assembly language in one of the classes
mention assembler closest to machine language
mention unique to cpu architecture
bring in my system 370 book
http://en.wikipedia.org/wiki/IBM_Basic_assembly_language#Examples
http://en.wikipedia.org/wiki/X86_assembly_language
This is a JOptionPane like utility for reading data into scripts (bash, perl etc.) on an X Window desktop shell.
!Install
Install the package xdialog using yum, it provides the binary Xdialog.
!Use
This is not the same version, but it behaves the same way.
http://web.mit.edu/outland/share/doc/Xdialog-2.1.2/syntax.html
and try the man pages
!Example
{{{
[tricia@kryten ~]$ data=$(Xdialog --stdout --inputbox "gimme data..." 15 25)
[tricia@kryten ~]$ echo $data
}}}