Bird
Raised Fist0
Linux CLIscripting~20 mins

Why permissions protect system security in Linux CLI - Challenge Your Understanding

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Permission Protector
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Understanding file permissions with ls -l
What is the output of the command ls -l on a file with permissions -rw-r----- owned by user alice and group staff?
Linux CLI
ls -l example.txt
Adrw-r----- 1 alice staff 1234 Apr 27 12:00 example.txt
B-rw-r--r-- 1 alice staff 1234 Apr 27 12:00 example.txt
C-rwxr-xr-x 1 alice staff 1234 Apr 27 12:00 example.txt
D-rw-r----- 1 alice staff 1234 Apr 27 12:00 example.txt
Attempts:
2 left
💡 Hint
Look carefully at the permission string and the file type character at the start.
🧠 Conceptual
intermediate
1:30remaining
Why do permissions protect system security?
Which of the following best explains why file permissions are important for system security?
AThey make files load faster by limiting access.
BThey control who can read, write, or execute files, preventing unauthorized access or changes.
CThey encrypt files so only certain users can open them.
DThey automatically back up files to protect data.
Attempts:
2 left
💡 Hint
Think about what permissions actually do to files.
🔧 Debug
advanced
2:00remaining
Identifying permission error in script
A script tries to write to a file but fails with a 'Permission denied' error. Which command will correctly fix the permission so the script owner can write the file?
Linux CLI
echo 'Hello' > /var/log/app.log
Achmod u+w /var/log/app.log
Bchmod o+w /var/log/app.log
Cchmod g+w /var/log/app.log
Dchmod a-w /var/log/app.log
Attempts:
2 left
💡 Hint
The script owner needs write permission, so add write permission to the user.
🚀 Application
advanced
2:00remaining
Setting secure permissions for a private directory
You want to create a directory secret that only you can access. Which command sets the correct permissions?
Amkdir secret && chmod 755 secret
Bmkdir secret && chmod 777 secret
Cmkdir secret && chmod 700 secret
Dmkdir secret && chmod 600 secret
Attempts:
2 left
💡 Hint
Only the owner should have read, write, and execute permissions.
🧠 Conceptual
expert
1:30remaining
Effect of removing execute permission on a script
What happens if you remove the execute permission from a shell script file?
AYou cannot run the script directly, but you can still read and edit it.
BThe script will run faster because it is not executable.
CThe script will delete itself automatically.
DThe script will run but with limited features.
Attempts:
2 left
💡 Hint
Think about what execute permission controls.

Practice

(1/5)
1. Why are file permissions important for system security in Linux?
easy
A. They delete unused files to save disk space.
B. They speed up the computer's processing power.
C. They automatically update software to the latest version.
D. They control who can read, write, or execute files, preventing unauthorized access.

Solution

  1. Step 1: Understand the role of permissions

    Permissions decide who can read, write, or run files, which controls access.
  2. Step 2: Connect permissions to security

    By limiting access, permissions stop unauthorized users from changing or viewing files.
  3. Final Answer:

    They control who can read, write, or execute files, preventing unauthorized access. -> Option D
  4. Quick Check:

    Permissions protect access = A [OK]
Hint: Permissions limit file access to protect security [OK]
Common Mistakes:
  • Thinking permissions speed up the computer
  • Believing permissions update software
  • Assuming permissions delete files automatically
2. Which command correctly changes a file's permissions to allow the owner to read and write, but no permissions for others?
easy
A. chmod 600 filename
B. chmod 777 filename
C. chmod 644 filename
D. chmod 755 filename

Solution

  1. Step 1: Understand chmod numeric codes

    600 means owner can read/write (6), group and others have no permissions (0).
  2. Step 2: Match permissions to requirement

    Only chmod 600 filename sets owner read/write and no permissions for others.
  3. Final Answer:

    chmod 600 filename -> Option A
  4. Quick Check:

    600 = owner rw, others none [OK]
Hint: 600 means owner rw, others none [OK]
Common Mistakes:
  • Choosing 777 which gives all permissions to everyone
  • Confusing 644 with no permissions for others
  • Using 755 which allows execute permission
3. What will be the output of the command ls -l secret.txt if the file has permissions -rw------- and you are logged in as a different user?
medium
A. You will get a 'Permission denied' error when trying to read the file.
B. You will see the file details but cannot read the file.
C. You will see the file details and can read the file.
D. The file will not appear in the directory listing.

Solution

  1. Step 1: Analyze file permissions

    -rw------- means only owner has read/write, others have no permissions.
  2. Step 2: Understand ls -l behavior

    ls -l displays file metadata (permissions, owner, size) without needing read permission on the file; assumes directory allows access.
  3. Final Answer:

    You will see the file details but cannot read the file. -> Option B
  4. Quick Check:

    ls -l shows details, read denied [OK]
Hint: ls -l shows details despite no read permission [OK]
Common Mistakes:
  • Thinking file won't show in listing
  • Assuming read access is allowed
  • Confusing file details visibility with read permission
4. You run chmod 755 myscript.sh but the script still cannot be executed by others. What is the most likely problem?
medium
A. The file is owned by root and others have no execute permission.
B. The script has syntax errors stopping execution.
C. The file system is mounted with 'noexec' option preventing execution.
D. The user forgot to save the file after editing.

Solution

  1. Step 1: Check permissions set by chmod

    chmod 755 sets execute permission for owner, group, and others.
  2. Step 2: Consider other causes for execution failure

    If permissions are correct but execution fails, 'noexec' mount option may block running scripts.
  3. Final Answer:

    The file system is mounted with 'noexec' option preventing execution. -> Option C
  4. Quick Check:

    Permissions okay but noexec blocks execution [OK]
Hint: Check mount options if permissions allow but execution fails [OK]
Common Mistakes:
  • Assuming ownership blocks execution with 755 permissions
  • Blaming script syntax for permission errors
  • Forgetting about file system mount options
5. You want to secure a directory so only the owner can list and access files inside, but others can still enter the directory without seeing contents. Which permission setting achieves this?
hard
A. chmod 711 directory
B. chmod 777 directory
C. chmod 755 directory
D. chmod 700 directory

Solution

  1. Step 1: Understand directory permissions

    Read (r) allows listing contents, execute (x) allows entering the directory.
  2. Step 2: Match permissions to requirement

    711 means owner has rwx, others have execute only (can enter but not list files).
  3. Final Answer:

    chmod 711 directory -> Option A
  4. Quick Check:

    Execute only for others = enter but no list [OK]
Hint: Execute without read lets others enter but not list [OK]
Common Mistakes:
  • Using 700 which blocks others from entering
  • Using 755 which allows others to list files
  • Using 777 which gives full access to everyone
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard