Changes

Jump to: navigation, search

Tutorial 1: Using Your Matrix Server Account

706 bytes added, 20:33, 4 September 2023
no edit summary
{{Admon/caution|DO NOT USE THIS VERSION OF THE LAB. This page will no longer be updated.|'''New version here:''' https://seneca-ictoer.github.io/ULI101/A-Tutorials/tutorial1<br />'''Andrew's students please go here:''' http://wiki.littlesvr.ca/wiki/OPS145_Lab_1}}
=USING YOUR MATRIX SERVER ACCOUNT=
<br>===Main Objectives of this Practice Tutorial===  :* Learn how to access your '''Matrix''' server account (from home and/or from Seneca computer lab). :* Learn several ways to '''exit''' your Matrix Linux Account session. :* Understand the '''Linux command structure''' and how to get '''help''' with Linux command usage. :* Become efficient with '''Linux command line editing''' by using '''short-cut keys'''. :* Issue a '''checking program''' (i.e. ''Shell Script'') to '''confirm''' that you accessed your Matrix account. :* Perform '''LINUX PRACTICE QUESTIONS''' for additional practice<br><br>.
===Tutorial Reference Material===
|- valign="top" style="padding-left:15px;"
|colspan="2" |'''Slides:'''<ul><li>Week 1 Lecture 1 Notes:<br> [https://githubwiki.comcdot.senecacollege.ca/ULI101uli101/slides/raw/main/ULI101-1.1.pdf PDF] | [https://githubwiki.cdot.comsenecacollege.ca/ULI101uli101/slides/raw/main/ULI101-1.1.pptx PPTX]</li><li>Week 1 Lecture 2 Notes:<br> [https://githubwiki.cdot.comsenecacollege.ca/ULI101uli101/slides/raw/main/ULI101-1.2.pdf PDF] | [https://githubwiki.cdot.comsenecacollege.ca/ULI101uli101/slides/raw/main/ULI101-1.2.pptx PPTX] <br></li></ul>'''Tutorials:'''<ul><li>[https://wiki.cdot.senecacollege.ca/wiki/Tutorial_1:_Using_Your_Matrix_Server_Account#INVESTIGATION_1:_ACCESSING_YOUR_MATRIX_LINUX_ACCOUNT HOWTO: Access Your Matrix Account]</li></ul>'''Windows SSH client Software:'''<ul><li>[http://www.sfsu.edu/ftp/win/ssh/SSHSecureShellClient-3.2.9.exe SSH/SFTP]</li><li>[https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html Putty]</li><li>[https://www.bitvise.com/ssh-client-download Bitvise SSH Client]</li><li>[https://mobaxterm.mobatek.net/download-home-edition.html MovaXterm]</li></ul>
| style="padding-left:15px;" |'''Matrix Account Access:'''
= KEY CONCEPTS=
===Purpose of Having a Your Student Account on Matrix Linux Server Account===
While attending Seneca College, you will be using many different computer systems.
|-
| style="padding-left:0px;width:10%" |'''mylearn.senecacollege.ca'''
| style="padding-left:15px;width:65%" |Learning Content Management System (''Link to Resources'' / ''Student Grades'' / ''Online Quizzes'')
 
|-
| style="padding-left:0px;width:10%" |'''ict.senecacollege.ca'''
| style="padding-left:15px;width:65%" |Online access to slides, documents via webpage links
|-
| style="padding-left:0px;width:10%" |'''wiki.cdot.senecacollege.ca'''
| style="padding-left:15px;width:65%" |''Student Lecture Notes'' / ''Tutorials'' (weekly, review) / ''Practice Questions'' / ''Additional Learning Resources''
|-
| style="padding-left:0px;width:10%" |'''<span style="color:blue;">matrix.senecacollege.ca</span>'''
| style="padding-left:15px;width:65%" |Matrix is our Linux Account server environment used for "''hands-on Practicepractice''". Each ULI101 student has an account on this server.
|}
[[Image:cli-prompt.png|thumb|right|120px|A '''shell''' is an interface / interpreter to allow a user to communicate with the Linux computer system. ]]
Although you need to study concepts throughout this course (slides, etc.), you will also need to get '''hands-on practice running Linux commands as well as performing and submitting online tutorials'''.
[[Image:cli-prompt.png|thumb|right|120px|A '''shell''' is an interface / interpreter to allow a user to communicate with the Linux computer system. ]]Although you need to study concepts throughout this course (slides, etc.), you will also need to get '''hands-on practice running Linux commands as well as performing and submitting online tutorials'''.<br>This requires that you '''connect to a Linux server''' (Matrix) and become comfortable with '''issuing Linux commands'''.
In Unix/Linux, a '''shell''' is simply an '''interface''' to allow a user to communicate with the Linux computer system (server). Linux shells have evolved (improved) over a period of time. You will be using the '''Bash Shell''' which is considered to be ''user-friendly''. By understanding how to issue Linux commands, you can create a file that contains Linux commands (called a '''shell script''') later in this course to automate tasks to make you a more '''productive''' Linux user and system administrator.
[[Image:gp1.png|thumb|right|130px|'''Seneca Student VPN''' ]]
Seneca College is "rolling-out" additional measures to improve '''network security'''. One of these measures is to implement '''multi-factored authentication'''. All Seneca College students are required to connect to the '''Seneca Student VPN''' in order to be able to connect to their '''Matrix''' Linux accountwhen outside of campus as a '''network security''' measure.<br><br>The Seneca Student VPN uses multi-factor authentication (MFA) when logging in to verify you are who you say you are. ''<b>Multi-factor authentication</b> is an electronic authentication method in which a computer user is granted access to a website or application only after successfully presenting two or more pieces of evidence (or factors) to an authentication mechanism: knowledge (something the user and only the user knows).'' Reference: https://en.wikipedia.org/wiki/Multi-factor_authentication<br><br> You should have received an email e-mail message (also available in course announcements) regarding with instructions on how to setup set up your Smart Phone to connect and valid via the Seneca Student VPNsmartphone for multi-factor authentication. '''NOTE:''' If you haven't done this installed it yet, please perform the steps provided in do so by following the following linkITS instructions here:<br>https://students.senecacollege.ca/spaces/186/it-services/wiki/view/1025/student-vpn<br><br>
In the next investigation, you will learn how to '''connect''' to and '''login''' to your Matrix server account from a remote computer<br>such as your '''home desktop computer''', '''laptop''' or '''tablet''' computer.<br><br>
===Connecting to Your Matrix Account===
[[Image:cls-shell.png|thumb|right|100px|Connect to Matrix via'''ssh''' command]]There are two basic methods to connecting to your Matrix account. '''Method 1: Run ssh Command from command prompt:'''
[[Image:cls-shell.png|thumb|right|100px|Connect After connecting to Matrix viathe '''Seneca Student VPN'''ssh, you can open a ''' command]]:terminal''' in '''Windows 10 (or above)''', '''Mac''' or '''Method 1: Run ssh Command from command prompt:Linux'''computer and issue the following command:: <span style="color:blue;font-weight:bold;">ssh senecauserid@matrix.senecacollege.ca</span>
:After connecting to the '''Seneca Student VPN''', you can open a '''command terminal'''<br>in your '''Newer Windows 10''', '''Mac''' or '''Linux''' computer and issue the following command:<br><br><span style="color:blue;font-weight:bold;">ssh senecauserid@matrix.senecacollege.ca</span><br><br>
[[Image:ssh-main-window.png|thumb|right|100px|Connect to Matrix via '''graphical''' SSH Program ]]
:'''Method 2: Run graphical ssh program via MyApps in Seneca computer lab:''' :If you are in a Seneca computer lab, you can use MyApps to run a '''graphical SSH application''' for your Windows machine. One advantage of using this method is that you are already at Seneca and are NOT required to connect to the student VPN.<br><br> 
'''NOTE:''' You instructor may show you how to run a graphic Linux VM in order to connect to your Matrix account (if interested, refer to the optional tutorial at the end of this semester).
<br><br><br>
=INVESTIGATION 1: ACCESSING YOUR MATRIX LINUX ACCOUNT=
 <span style="color:red;">'''{{Admon/important|ATTENTION''': This online weekly tutorial will be required to must be completed by '''Friday at 11:59pm in week Week 2 by midnight''' to obtain a grade of '''2%''' towards this course</span><br><br>.|It is essential that you complete these Weekly Tutorials fully and on time. These are your major learning tool in the course. There are no late marks.}}
In this section, you will learn how to access your Matrix Linux account by two different methods:
:* From your '''home computer''' <br>
:* From a '''workstation in a Seneca College''' lab via '''MyApps'''
 
===METHOD 1: CONNECTING TO YOUR MATRIX ACCOUNT FROM YOUR HOME COMPUTER===
<table style="margin-left:50px;">
<tr valign="top" style="text-align:center;">
<th>'''Newer Version of Windows 10(or above):'''</th> <th>'''MacOSXmacOS:''' </th>
<th>'''Linux:''' </th>
</tr>
# It is recommended to repeat these steps with connecting to your Matrix account from a Seneca lab workstation until you become comfortable with the process.<br><br>
In the next investigation, you will learn how to issue Linux commands from the command prompt (referred to as the "shell"), learn how to get help with Linux commands, use command-line editing short cut keys, and run a program to confirm that you connected to your Matrix account in order to get marks for this online tutorial.<br><br>
=INVESTIGATION 2: USING THE LINUX SHELL =
==Linux Command Structure==
The Bash shell in Matrix allows you to interact with your Matrix account Linux by issuing typing commands. '''The basic Linux command structure is as follows:''' <span style="font-family:courier;color:blue;font-weight:bold">command argument1 argument2 ... </span>
Some Linux commands can be used as-is (e.g. '''pwd''', '''date''', 'The General ''ls''', '''cal'''), but many Linux Command Structure is as follows:commands can also be issued with arguments (e.g. '''cal 2002''', '''cd /bin''', '''<br><span style="fontls -family:courier;color:blue;fontl -weight:bold">command argument1 argument2 .a /bin''' ).. </span>
Some Linux commands can be issued by entering the Linux command line without arguments (e.g. '''pwd''', '''date''', '''ls''', '''cal'''),<br>but many Linux commands can be issued with arguments (e.g. '''cal 2002''', '''cd /bin''', '''ls -l -a /bin''' ).<br><br>'''What Does is an Argument Representargument?'''
An argument is used to change the default behaviour of a command. Arguments come in three major forms: # A command '''argumentoption''' can respresent.#* Example:<code>-l</code>:* a # A '''file pathname'''.#* Example:* a command '''option'''<code>/etc</code>:* a # A series of characters (i.e. '''text''') that the command can use .#* Example: <code>"Hello, world."</code>
An '''argument''' is <u>must be separated</u> from a command (or and from other arguments) by whitespace (a '''SPACE''', '''MULTIPLE SPACES''' or a '''TAB''').<br><br>
'''Perform the Following Steps:'''
# Make certain Confirm that you are logged into your Matrix account.<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">pwd</span><br><br>#* '''Explanation:''' The output from this Linux command basically shows your '''current location''' in on the Matrix server(otherwise known as your '''p'''resent '''w'''orking '''d'''irectory).<br>This represents a '''directory pathname''' to your home directory. We will discuss ''pathnames'' later in this course.<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">ls</span><br><br>#* '''Question:''' What do you notice?<br><br>#* '''Answer:''' If there were are any files in your home directory, just only their file names would be are displayed.<br><br># Issue Change your directory location by issuing the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">cd /binetc</span><br><br># Issue the following Linux command to confirm your changed current location: <span style="font-family:courier;color:blue;font-weight:bold">pwd</span>#* '''Result:''' Your Linux session should display <brcode>/etc/<br/code>when running this command. If your output is different, retrace your steps to make sure you haven't skipped anything or had a typo in a command.# Issue the following Linux commandagain: <span style="font-family:courier;color:blue;font-weight:bold">ls</span><br><br>#* '''Question:''' What do you notice?<br><br>How is this different from the last time you ran it?# Issue Re-run the following Linux ls command using an '''option''': <span style="font-family:courier;color:blue;font-weight:bold">ls -l</span><br><br>#* '''Question:''' What do you notice?<br><br>#* '''Answer:''' The '''-l''' option combined with the '''ls''' command provides displays a '''detailed''' ("''long''") listing of the same files , providing you with more information on a separate line for about each file.<br><br>This is called metadata (data about data), and includes information such as last modified date, file size, ownership and permissions.# Issue the following Linux command to return Return to your home directory: <span style="font-family:courier;color:blue;font-weight:bold">cd</span><br><br># Issue the following Linux command Now confirm you've changed back to confirm your current locationhome directory: <span style="font-family:courier;color:blue;font-weight:bold">pwd</span>#* '''Result:''' The shell should display <brcode>/home/''yourusername''<br/code># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">ls /bin</span><br><br> # Issue the following Linux command to confirm your current location: <span style="font-family:courier;color:blue;font-weight:bold">pwd</span><br><br>#* '''Question:''' What do you notice?<br><br>#* '''Question:''' What makes this command with that argument useful if you are current currently located in your home directory?<br><br># Issue a Linux command that you have already learned to change to your '''home''' directory<br>and to '''confirm''' that you have returned to your home directory.<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">clear</span><br><br>#* '''Question:''' What do you notice? How would Why is this command be helpful?<br>#* '''FYITip:''' The short-cut shortcut keys to clear the screen for the Bash shell isare: <span style="font-family:courier;color:font-weight:bold">ctrl-l</span><br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">who</span><br><br>#* '''Question:''' What information does this command show?<br><br>#* '''Answer:''' This command lists users that are logged into the same Matrix Linux server as yourself.<br>#* '''NOTE:''' Remember that the Matrix Linux cluster contains several servers, so it does not (or nodes). It won't display<br>all users that are logged onto those other machines within that into the cluster!<br><br>, only the ones on the same node as you. # Issue the following Linux command: <span style="color:blue;font-weight:bold">whoami</span><br><br>#* '''Question:''' What does this command display? #* '''Question:''' What do you think is the purpose of this command?<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">cal</span><br><br>#* '''Question:''' What is the purpose of does this commanddo?<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">cal 20212035</span><br><br>What #* '''Question:''' How and why is the purpose of this command using this argumentoutput different?<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">cal 2 20212035</span><br><br>#* '''Question:''' What is the purpose do each of this command using those two these numbers do?#* '''numbersQuestion:''' as What do you think would happen if you reversed the order of those arguments?<br><br>(i.e. cal 2035 2)
==Getting Help with Linux Commands==
With the Linux OS containing over '''2500''' commands and utilities, it is good 's important for a Linux user or <br>users and Linux system administrator administrators (sysadmin) to learn about how to use commands “on-the-fly”.<br><br> The '''man''' command can provide utility is an interactive collection of manual pages that provides information on how to use a given command<br>(i.e. '''command usage''', '''acceptable command arguments''', '''command options''', '''examples''').<br><br> # Issue For an example, issue the following commandfor the manual page about the manual utility: <span style="font-family:courier;color:blue;font-weight:bold">man man</span><br><br>#* You may notice that the online manual categories commands into sections or '''numbered volumes'''.<br><br># Type Press the '''SPACE''' key to move to the next screen.<br><br>#* '''Question:''' How many '''volume numbers''' are contained in the man pages (like '''executable commands''',<br>'''games''', or '''system administrator commands''')?<br><br>'''TIP:''' # You can use the following '''short-cut shortcut keys''' within the man command to <br>help navigate throughout this utility to get help with the ls command (refer to table below):<br><br>#::<table cellpadding="3"><tr><th style="border-bottom: 1px solid black;">Keyboard Shortcut</th><th style="border-bottom: 1px solid black;">Purpose</th></tr><tr><td>'''ENTER'''</td><td>Move down one line</td></tr><tr><td>'''SPACEBAR'''</td><td>Move one screen down</td></tr><tr><td>'''&lt;ctrl&gt;&lt;b&gt;'''</td><td>Move one screen up</td></tr><tr><td>'''/pattern/'''</td><td>Search for Pattern</td></tr><tr><td>'''q'''</td><td>quit man utility</td></tr></table><br># If you are connected to Matrix through a terminal application, you can also use your mouse's scroll wheel.# Press the letter <span style="font-family:courier;color:blue;font-weight:bold">q</span> key to exit the man command.<br><br># Issue Use the following Linux command ''man'' utility to get help with the ''ls '' command: <span style="font-family:courier;color:blue;font-weight:bold">man ls</span><br><br># Navigate through the man utility for the '''ls''' Linux command manual page and note write down the '''option letters''' that correspond to the following descriptions:<br><ul><li>#*"'''use a long listing format'''"</li><li>#*"'''do not ignore entries starting with .'''" (i.e. hidden files)</li><li>#*"'''sort by file size'''"</li><li>#*"'''append indicator (one of */=>&|) to entries'''" (i.e. type of file)</li></ul><br># Exit the man utility for the ''ls'' command.<br><br># Issue the '''ls''' command for using <u>each</u> of those option letters you noted in '''step 5''' to see how this the command differs for 's output changes with each option.<br><br>#* '''NOTE:''' The '''man''' utility can be used with the '''-k''' option to help list Linux commands that match a text pattern<br>that is contained within the help screen for a Linux command.<br><br># '''Pipeline commands''' can be used to filter-out unnecessary output. In the next command that you will be issuing,<br>the output from the '''man -k''' command, is sent into the '''grep''' command to ''filter'' (i.e. ''trap'') only output that matches the pattern "8"<br>(The number "8" refers to the category of type of command - in this case, administration commands).<br><br>We will learn more about pipeline commands later in this course.<br><br># Issue the following Linux pipeline command: <span style="font-family:courier;color:blue;font-weight:bold">man -k user | grep 8</span><br><br>#* '''Question:''' How does this ''pipeline command'' make it easier to obtain information regarding man command?<br><br># If you wish to change your passwordon typical Linux systems, you can change it by issuing the command: <span style="font-family:courier;color:blue;font-weight:bold">passwd</span>{{Admon/caution|Do NOT run the <code>passwd<br/code>command on Matrix!|Unique to this college, your Linux password is changed automatically when you change your ''myseneca'' password.}}#* '''Question:''' What option for the ''passwd '' command can be used to change user info (such as name)?<br>#* '''Hint:''' use the '''man''' command for '''passwd'''.<br><br>'''NOTE:''' Do '''NOT''' run the ''passwd'' command. Unique for this college, your Matrix password<br>is changed automatically when you change your '''myseneca''' password.<br><br><br># Press the letter <span style="font-family:courier;color:blue;font-weight:bold">q</span> key to exit the man command.<br><br> You will now learn how to perform '''command line editing'''<br>to correct syntax errors while typing Linux commands PRIOR to pressing the ENTER key.
==Command Line Editing==
'''Running a Shell Script to Check Student Online Tutorial Participation'''
<table align="right"><tr valign="top"><td>[[Image:script-check-1.png|thumb|right|250px|If all all check pass, then user performed can proceed.]]</td><td>[[Image:script-check-2.png|thumb|right|450px|If there is a warning, then feedback is provided to user to correct and re-run checking script.]]</td></table>
Professors will require students successfully perform these online tutorials for marks (within a deadline). <br>In order to confirm that you successfully performed a tutorial, you will be required to run a program<br>(or in later tutorials, several programs) to prove that you successfully completed tasks in a tutorial and get marks. These programs (known as Shell Scripts) will check your work and offer feedback if you made mistakes, so you can make corrections.<br>Making corrections (i.e. troubleshooting) and re-running these checking programs until you are successful will help students<br>gain "hands-on" experience as well as "trouble-shooting experience.
These programs (known as Shell Scripts) will check your work and offer feedback if you made mistakes, so you can make corrections. Making corrections (i.e. troubleshooting) and re-running these checking programs until you are successful will help students gain "hands-on" experience as well as "trouble-shooting experience.
<table align="right"><tr valign="top"><td>[[Image:script-check-1.png|thumb|right|250px|If all all check pass, then user performed can proceed.]]</td><td>[[Image:script-check-2.png|thumb|right|450px|If there is a warning, then feedback is provided to user to correct and re-run checking script.]]</td></table>
If you have correctly completed the required tasks, the user can proceed. If the checking shell script detects an '''error''', then it will provide feedback to allow the student to fix that problem so they can re-run the checking shell scripts until they have successfully completed a task.
 
'''Perform the Following Steps:'''
# Make certain that your current directory is '''your home directory'''<br>By by entering the following Linux command:<br>#* <span style="color:blue;font-weight:bold;font-family:courier;">cd</span><br><br>#Issue the following command to run a checking script :<br>#* <span style="font-family:courier;color:blue;font-weight:bold">~uli101/week1-check</span><br><br>#* '''Note:''' The beginning character "'''~'''" is called '''tilde'''. You get this character by pressing '''SHIFT''' + '''`'''<br>(which is the key to the left of the number 1 on your keyboard). <br><br># Your screen should clear and indicate that you have proved that you have successfully logged in.<br><br># An email will be sent to your Seneca email as '''confirmation''' in case your ULI101 professor is assigning marks to these tutorials.<br><br>#* Keep those confirmation email messages for the duration of this semester as proof that you have completed those checking scripts in case there is a discrepancy in tutorial grades.<br><br> 
<!--
The purpose of this section is to obtain '''extra practice''' to help with '''quizzes''', your '''midterm''', and your '''final exam'''.
Here is a link to the MS a Word Document document of ALL of the questions displayed below but with extra room to answer on the document tosimulate a quiz:
: https://githubwiki.com/ULI101/labscdot.senecacollege.ca/rawuli101/mainfiles/uli101_week1_practice.docx
Your instructor may take-up these questions during class. It is up to the student to attend classes in order to obtain the answers to the following questions. Your instructor will NOT provide these answers in any other form (eg. e-mail, etc).
 
'''Review Questions:'''

Navigation menu