_______________________________________________________________________________
Module 2: Users, Groups, and Permissions
_______________________________________________________________________________
1. The All-Powerful "Root" and sudo
The Root user is the god-mode account. It can delete the entire operating system
with one command. Because that's dangerous, we use sudo (SubUser DO).
Command: sudo [command]
Analogy: It’s like a security guard giving you a temporary master key. You
perform one task, then give the key back.
/-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=/
2. Understanding Permissions (ls -l)
When you run ls -l, you see a string like this: -rwxr-xr--
This string is broken into three sets of three:
User (Owner): What the person who owns the file can do.
Group: What members of the file's assigned group can do.
Others: What everyone else on the system can do.
The Letters:
r (Read): Can view the file.
w (Write): Can edit/delete the file.
x (Execute): Can run the file (like a program or script).
/-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=/
3. Changing Permissions (chmod)
You change permissions using the chmod command. The easiest way is using
numbers:
4 = Read
2 = Write
1 = Execute
You add them together to get the permission level.
7 (4+2+1) = Full access (rwx)
5 (4+0+1) = Read & Execute (r-x)
6 (4+2+0) = Read & Write (rw-)
Example: chmod 755 myfile.txt (Owner gets 7, Group gets 5, Others get 5).
/-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=/
4. Managing Users
sudo useradd [name]: Creates a new user.
sudo passwd [name]: Sets the password for that user.
sudo chown [user]:[group] [file]: Changes who owns the file.
/-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=/
Module 2 Practical Challenge
This is where you act like a real System Administrator.
Create a New Identity: Create a user named app_user. Give them a password.
The Secret Folder: Create a directory in /home called top_secret.
Lock it Down: Change the ownership of top_secret so it belongs to app_user.
Restrict Access: Change the permissions (chmod) so that app_user can do
everything (7), but nobody else on the system (group and others) can even
see inside the folder (00).
Hint: The command will look like sudo chmod 700 /home/top_secret
Test It: Try to cd into that folder as your regular user. You should get
a "Permission Denied" error. Then try sudo cd (or sudo ls) to see if the
"master key" works.
_______________________________________________________________________________
(DIR) Module 1
(DIR) Module 2
(DIR) Module 3
(DIR) Module 4
(DIR) Back to Home