Activity 5 - Secure User Permissions
Oh no. Some of our files might have been messed with! Let’s secure our notes, file1. We don’t want a hacker to mess with these!
How do we limit access to our files?
By giving users “permissions” on files!
Permissions are a way for the computer to determine who has access to files and what they can do with those files.
In Linux, there are three common types of access to a file that a user might request: “read”, “write”, or “execute”.
“Read” access means that a user may open and read a file. “Read” access is often denoted with a
“Write” access means that a user may open and write to a file. This includes renaming and moving a file to a different location in the filesystem. “Write” access is often denoted with a
“Execute” access means that a user may attempt to run the file as a program. “Execute” access is often denoted with a
But how do we know how secure our files are?
Is there a command that we have learned so far that can show us how secure our files are?
Feel free to go back if you need to!
We should keep using that command to check if we changed the permissions as expected.
How do we secure the files with permissions then?
chmod u=rwx g=rx o=x file1
chmod is a command used to modify the permissions of your files for the following 3 different groups of users:
- the user and owner of the file
- the group and the members of the group of people with access to the file
- the others or anyone else
These groups can be modified to have permissions to do the following:
Try it on your own!
Now, let’s try to change the permissions of our files. We want anyone outside of our group and aside from ourselves to have no permissions for
file1. How do we do that?
Fun Fact: Shortcut!
chmod can also be used with simple number commands. These commands are written like:
chmod 751 [insert filename]
The values can be understood as giving users the permission to read, write, and execute.
What permissions do the other two values give?
|7||read + write + execute|
|6||read + write|
|5||read + execute|
|3||execute + write|