Changes

Jump to: navigation, search
INVESTIGATION 1: NUMBERING CONVERSIONS
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>
'''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''': This tutorial will provide additional '''practice''' with the necessary skills for completing this weeks segment of your '''assignment''' and is not worth marks.</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 '''assignments''' 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 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>

Navigation menu