Understanding Numeric Permission Modes (755, 644) in Linux
📖 Scenario: You are managing files on a Linux server. You need to set correct permissions so that files and folders are secure but accessible as needed.Numeric permission modes like 755 and 644 are common ways to set these permissions quickly.
🎯 Goal: Learn how to create files and directories, then set their permissions using numeric modes 755 and 644.You will practice creating a directory and a file, then apply these numeric permissions and check the results.
📋 What You'll Learn
Create a directory named project
Create a file named readme.txt inside the project directory
Set the directory permission to numeric mode 755
Set the file permission to numeric mode 644
Use ls -l to display the permissions and verify
💡 Why This Matters
🌍 Real World
Setting correct file and directory permissions is essential for security and proper access control on Linux servers and systems.
💼 Career
System administrators, DevOps engineers, and developers often need to manage permissions to protect data and ensure applications run correctly.
Progress0 / 4 steps
1
Create the directory project
Type the command to create a directory named project in your current folder.
Linux CLI
Hint
Use the mkdir command followed by the directory name.
2
Create the file readme.txt inside project
Type the command to create an empty file named readme.txt inside the project directory.
Linux CLI
Hint
Use the touch command with the path project/readme.txt.
3
Set the directory permission to numeric mode 755
Type the command to set the permission of the project directory to numeric mode 755.
Linux CLI
Hint
Use the chmod command with 755 and the directory name.
4
Set the file permission to numeric mode 644 and verify
Type the commands to set the permission of the file project/readme.txt to numeric mode 644 and then list the details of the project directory using ls -l project to verify the permissions.
Linux CLI
Hint
Use chmod 644 project/readme.txt to set file permission.
Then use ls -l project to see the permissions.
Practice
(1/5)
1. What does the numeric permission mode 755 mean for a file in Linux?
easy
A. User can read, write, execute; group and others can read and execute
B. User can read and write; group and others can only read
C. User, group, and others can read, write, and execute
D. User can read and execute; group and others have no permissions
Solution
Step 1: Understand numeric permission digits
Each digit represents permissions for user, group, and others respectively. 7 means read(4)+write(2)+execute(1)=7, 5 means read(4)+execute(1)=5.
Step 2: Decode 755
User (7) has read, write, execute; group (5) and others (5) have read and execute only.
Final Answer:
User can read, write, execute; group and others can read and execute -> Option A
Quick Check:
755 = rwx r-x r-x [OK]
Hint: 7 means full rights; 5 means read+execute only [OK]
Common Mistakes:
Confusing 5 with write permission
Thinking 7 means read+write only
Mixing group and others permissions
2. Which of the following is the correct command to set a file named script.sh to permission mode 755?
easy
A. chmod 644 script.sh
B. chmod 700 script.sh
C. chmod 777 script.sh
D. chmod 755 script.sh
Solution
Step 1: Identify the command to change permissions
The command to change file permissions is chmod followed by the numeric mode and filename.