Changes

Jump to: navigation, search
LINUX PRACTICE QUESTIONS
|- valign="top" style="padding-left:15px;"
|colspan="1" width="22%" |'''Slides:'''<ul><li>Week 4 Lecture 1 Notes:<br>[https://ictgithub.com/ULI101/slides/raw/main/ULI101-4.1.pdf PDF] | [https://github.com/ULI101/slides/raw/main/ULI101-4.senecacollege1.capptx PPTX]</~murrayli><li>Week 4 Lecture 2 Notes:<br> [https://github.saulcom/ULI101/slides/raw/uli101main/ULI101-Week44.2.pdf PDF] | [https://ictgithub.senecacollege.cacom/ULI101/slides/~murray.saulraw/uli101main/ULI101-Week44.2.pptx PPTX]<br></li></ul>
| style="padding-left:15px;" | '''Data Representation Definitions:'''
* [https://home.adelphi.edu/~siegfried/cs170/170l1.pdf Data Representation]<br>
* [https://en.wikipedia.org/wiki/Decimal Decimal Numbers]
* [https://en.wikipedia.org/wiki/Hexadecimal Hexadecimal Numbers]<br>
| style="padding-left:15px;"|'''File Permission Concepts:'''
* [https://www.booleanworld.com/introduction-linux-file-permissions/ Introduction to File Permissions]<br><br>
'''File Permission Commands:'''<br>
* [https://ss64.com/bash/chmod.html chmod]<br>
* [https://ss64.com/bash/umask.html umask]<br><br>
|colspan="1" style="padding-left:15px;" width="30%"|'''Instructional Videos:'''
* [https://www.youtube.com/watch?v=4nGgqLIKU9U Numbering Conversions]
* [https://www.youtube.com/watch?v=SdgiYoOi0CY File Permissions]
'''Changing File Permissions with "chmod" command:'''
[[Image:symbolic-chart.png|thumb|right|550px|Examples of adding, removing and setting permissions using the '''chmod''' command with the '''Symbolic''' method.]]
 
 
'''<span style="font-style:italic">Symbolic Method:</span>'''
The chmod can use '''symbols''' to ''add'', ''remove'', and ''set'' <span style="font-family:courier;font-weight:bold;">rwx</span> permissions for the '''user''',<br>'''same group members''', and/or o'''ther group members''' for a directory or reqular file.
  <br><br><br><br><br><br><br><br><br><br><br>
'''<span style="font-style:italic">Octal (Absolute) Method:</span>'''
[[Image:octal-permissions.png|thumb|right|150px|Using octal numbers to represent setting file permissions.]]
Since 1 octal digit represents 3 binary digits, one octal digit can represent the <span style="font-family:courier;font-weight:bold;">rwx</span> permission granted or NOT granted. The permissions '''rwx''' are be in the form of 3 binary digits (1 represents the permission granted and 0 represents the permission NOT granted).
[[Image:absolute-chart.png|thumb|left|550px|Examples of adding, removing and setting permissions using the '''chmod''' command with the '''Absolute / Octal''' method.]]
<br><br><br><br><br><br><br><br><br>
'''NOTE:''' You can use the '''-R''' option to set permissions for directory, subdirectory and directory contents '''recursively'''.
  <table align="right"br><trbr><td>[[Image:umask-directory.png|thumb|right|200px|Setting '''umask''' for newly-created '''directories'''.]]</td><td>[[Image:umask-file.png|thumb|right|200px|Setting '''umask''' for newly-created '''regular files''']]</td></tr></tablebr>
'''Setting Permissions for Newly-Created Directories and Regular Files (umask):'''
<table align="right"><tr><td>[[Image:umask-directory.png|thumb|right|150px|Setting '''umask''' for newly-created '''directories'''.]]</td><td>[[Image:umask-file.png|thumb|right|150px|Setting '''umask''' for newly-created '''regular files''']]</td></tr></table>
The '''umask''' command is used to set the permissions of newly-created directories and regular files.
 
Issuing the '''umask''' command without arguments will display the current umask value.
=INVESTIGATION 1: NUMBERING CONVERSIONS=
<span style="color:red;">'''ATTENTION''': Effective '''May 9, 2022''' - this online tutorial will be required to be completed by '''Friday in week 5 by midnight'''<br>to obtain a grade of '''2%''' towards this course</span><br><br>
For this investigation, we will NOT be logged into our Matrix account, but it is recommended to have an '''MS Word document'''<br>open to manually perform numbering conversions.
[[Image:file-permission-practice-1.png|right|250px|thumb|]]
In this sectioninvestigation, you will get experience using the '''chmod''' command to '''change permissions'''<br>for <u> existing</u> files and the using '''umask''' command to automatically set permissions<br>for <u>newly-created</u> files.
# '''Login''' to your matrix account and issue a command to '''confirm''' you are located in your '''home''' directory.<br><br>
# Issue a single Linux command to create the following directory structure displayed in the diagram to the right.<br><br>'''NOTE:''' You will now run a shell script to confirm that you properly created that directory structure<br>in your ''Matrix'' account.<br><br>
# Issue the following Linux command to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts~uli101/week4-check-1</span><br><br>
# If you encounter errors, make corrections and '''re-run''' the checking script until you<br>receive a congratulations message, then you can proceed.<br><br>[[Image:file-permission-practice-2.png|right|450px|thumb|]]
# Issue Linux commands to create '''<u>empty</u> files''' for each of those newly created '''directories''' as shown in diagram to the right:<br><br>'''NOTE:''' You will now run another shell script to confirm that you properly created those empty files within those specified directories.<br><br>
# Issue the following Linux command to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts~uli101/week4-check-2</span><br><br>
# If you encounter errors, make corrections and '''re-run''' the checking script until you<br>receive a congratulations message, then continue the remaining steps.<br><br>Let's get practice '''viewing permissions''', '''changing permissions''', and <u>automatically</u> '''setting permissions for newly created files'''.<br><br>
# Issue the following Linux commands:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls -ld ~/documents ~/clients ~/vendors<br>ls -lR ~/documents ~/clients ~/vendors</span><br><br>'''NOTE:''' You should see permissions already set for those newly created directories and regular files.<br>What do these permissions mean for '''same group member''' and '''other group member''' access to those directory and regular files?<br><br>
# Issue the following Linux commands: <br><span style="color:blue;font-weight:bold;font-family:courier;">chmod 640 ~/documents/memos/memo*.txt<br>chmod 640 ~/documents/reports/report*.txt<br>chmod 640 ~/documents/contracts/contract*.txt</span><br><br>
# Issue the <span style="font-weight:bold;font-family:courier;">ls -lR</span> command for the '''~/documents''' directory to confirm that those regular file permission have changed.<br><br>Let's run a checking script to make certain you correctly set permissions for those directories and files.<br><br>
# Issue the following: <span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts~uli101/week4-check-3</span><br><br>
# If you encounter errors, make corrections and then re-run the checking script until you receive a congratulations message<br>and then continue with this tutorial.<br><br>Let's get some practice setting permissions to allow users to make editing changes to regular files.<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">chmod ugo-w ~/documents/memos/memo*.txt</span><br><br>
# Issue the following Linux command to create an empty regular file called '''myfile.txt''' in the '''~/shared2''' directory:<br> <span style="color:blue;font-weight:bold;font-family:courier;">touch ~/shared2/myfile.txt</span><br><br>
# Use the <span style="font-weight:bold;font-family:courier;">ls -l</span> command to view the permissions for this newly created regular file.<br><br>What do you notice about those permissions?<br><br>Let's run a checking script to make certain you correctly set permissions for those recently-created directories and files.<br><br>
# Issue the following: <span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts~uli101/week4-check-4</span><br><br>If you encounter errors, make corrections and then re-run the checking script until you receive a congratulations message<br>and then continue with this tutorial.<br><br>
# Logout of your Matrix account, and then log-back into your Matrix account.<br><br>
# Issue the following Linux command (without arguments): <span style="color:blue;font-weight:bold;font-family:courier;">umask</span><br><br>What happened? Referring to your notes, what do you need to do to make that umask value persistent?<br><br><span style="color:red;">'''WARNING''':<br>You should be <u>extremely</u> aware of your permissions since you may perform '''assignmentsmarked work''' for <u>other</u> courses on your '''Matrix''' server.<br>You should NOT set permissions to share your work with '''same group''' or '''other group''' members (unless given '''specific permissions instructions from your course professors''' involving '''assignment submission'''). If students can have access to your directories and assignment project files, they could '''copy''' your work and thus make yourself and other student(s) that copied your assignment work<br>to be charged with '''academic dishonesty'''.</span><br><br>: After you complete Complete the Review Questions sections to get additional practice, then work on your '''online assignment 2'''<br>and complete the sections '''1''' and '''2''' labelled: '''Practice Using The vi Text Editor''' and '''Permissions''' respectively.<br><br>
= LINUX PRACTICE QUESTIONS =
The purpose of this section is to obtain extra practice to help with your assignment #1, quizzes, your midterm, and your final ezam.
Here is a link to the MS Word Document of ALL of the questions displayed below but with extra room to answer on the document to
simulate a quiz:
https://ictgithub.senecacollege.cacom/ULI101/labs/~murray.saulraw/uli101main/uli101_week4_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).
[[Image:number-conversion-chart.png|right|450px|thumb|]]
'''Review Questions:'''
# Write a simple chart to show which values are represented for letter '''A - F''' for a hexadecimal number.
# How many '''binary''' digits does 1 octal digit represent?
# How many '''binary''' digits does 1 hexadecimal digit represent?[[Image:number-conversion-chart.png|right|450px|thumb|]]
# Use '''manual numbering conversion''' to complete the table displayed to the right.
13,420
edits

Navigation menu