Changes

Jump to: navigation, search
File Permissions
When '''directories''' and r'''egular files''' are created, they are assigned to an '''owner'''<br>(typically the username which is the creator).
To ''allow'' or ''limit'' '''access''' to those<br>files and directories, those files and directories are assigned to an <br>initial '''group''' referred to as a "'''primary group'''".[[Image:directory-permissions.png|thumb|right|350px|Permissions of a '''directory''' that contain subdirectories and regular files.]]Users that <u>own</u> those ''directories'' and ''regular files'' are referred to as '''users''', users that belong within the <u>same group</u> are referred to as '''same group members''', and those users that do <u>NOT</u> belong to a particular group are referred to as '''other group members'''.
Users that <u>own</u> those ''directories'' and ''regular files'' are referred to as '''users''', users that belong within<br>the <u>same group</u> are referred to as '''same group members''', and those users that<br>do <u>NOT</u> belong to a particular group are referred to as '''other group members'''. '''NOTE:''' In this course, we CANNOT create groups or assign users to groups in the '''Matrix''' server.<br>Instead, you may learn how to those tasks when or if you take a Unix/Linux administration course.<br>On the other hand, you can change which '''user''', '''same group members''' or '''other group members'''<br>can access or NOT access a directory or regular file.<br><br>[[Image:directoryfile-permissions.png|thumb|right|350px|Permissions of a '''directoryregular file''' that contain subdirectories and regular filescontained within a directory.]]
File Permissions consist of '''two-layers''':<br><br>'''First''', the permissions of a '''directory''' that contains regular files, and '''second''', permissions of the ''subdirectories and/or regular files'' within that directory.
A symbol ''dash'' "'''-'''" indicates that the permission has '''NOT''' been granted.
[[Image:file-permissions.png|thumb|right|350px|Permissions of a '''regular file''' contained within a directory.]]The permissions of '''newly-created''' directories and regular files are automatically assigned<br>via a '''user mask''' (we will discuss this shortly). In order to change permissions for <br>directories and regular files, you would use the '''chmod''' command.
'''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.
 [[Image:symbolic-chart.png|thumb|left|550px|Examples of adding, removing and setting permissions using the '''chmod''' command with the '''Symbolic''' method.]]<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.
# Issue the following: <span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts/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<br>(with and other student copying (s) that copied your assignment) work<br>to be accused of charged with '''academic dishonesty'''.</span><br><br>
: After you 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>
13,420
edits

Navigation menu