Open main menu

CDOT Wiki β

Changes

INVESTIGATION 2: FILE PERMISSIONS
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls -lR ~/documents</span><br>What do you noticed happened to the permissions for the regular files contained in those directories.<br>Did those regular file permissions change?<br><br>We want to now change those regular file permissions to the following settings: <span style="font-weight:bold;font-family:courier;">r w - r - - - - -</span><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 ~/dcouments/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 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>
# Use the '''<span style="font-weight:bold;font-family:courier;">ls''' </span< command to verify that those regular file's permissions have changed.<br><br>
# Using the nano or vi text editor, open the regular file '''~/documents/memos/memo1.txt'''<br>and type in some text and try to save your editing changes.<br>What happened?<br><br>
# To <u>abort</u> your editing session in '''vi''': type <span style="color:blue;font-weight:bold;font-family:courier;">:q!</span><br>To <u>abort</u> your editing changes in '''nano''': type <span style="color:blue;font-weight:bold;font-family:courier;">ctrl-x</span><br>type <span style="color:blue;font-weight:bold;font-family:courier;">n</span> and then press '''ENTER''' when prompted to save editing changes<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls -ld ~/shared2</span><br><br>Do the permissions for this newly created directory match the predicted permissions that you calculated in '''step #29'''?<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>
# 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>
13,420
edits