File permissions describe who can read, write and execute a file, or in the case of a directory, who can list its contents, save to it and change into it. In practice, this can be a tedious exercise, and there are resources to help I.T. professionals do this effectively and efficiently. However, those tools will make little sense to you, and would not be useful if you do not first grasp the fundamentals of Linux file permissions.
Use the Permissions section of the Fox textbook for reference in this lab.
After successful completion of this, you will be able to:
- Apply accurate file permissions to Linux files and directories
- Interpret a scenario to derive and apply accurate file permissions
- use
sudo
to execute a privileged command
Complete the following steps
Step 0: Get your materials ready
You need to log in to Linux from a Mac or Windows computer.
Step 1: Set up your files
Create a party-plan
directory in your home directory and add the following files. Try to do it all at once; i.e., on one line, pressing enter only once.
posters.txt
party-invitations.txt
secret-handshake.txt
Step 2: Set file permissions
Use a combination of file permission settings and file ownership settings to change the file permissions and ownership according to the table below.
File | Permissions scenario |
---|---|
posters.txt |
Everyone can read this file, but only your group can write to it. |
party-invitations.txt |
Nobody outside the students group should have any access to this. |
secret-handshake.txt |
Only the owner should have any access to this. And the owner should be root |
When youre done, take a screenshot of the ls -l
output in the party-plan
directory and paste it into your Word doc.
Step 3:
- Run the command
sudo su root
and interpret the results. - Run the command
apt-get update
(withoutsudo
) and interpret the results. - Run the command
sudo apt-get update
and interpret the results.
Answer the following questions
In a word document (or discussion thread, see below) answer the following questions:
- Did you get the single-line version of step 1? If so, what is it?
- In step 2, why did you not need to set any execute privileges?
- After completing step 2, try to edit the
secret-handshake.txt
. What happens, and why? - After completing step 2, try to delete the
secret-handshake.txt
. What happens, and why? - What is your interpretation of the results in step 3?
- Do a little research on what that application (
apt
) does. Should you, as a regular user, really be able to runapt-get update
? Defend your answer.
How to complete this lab
Submit your Word doc with screenshot and answers.