Bird
Raised Fist0
Wordpressframework~20 mins

File permission hardening in Wordpress - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
WordPress File Permission Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding WordPress file permission basics
Which file permission setting is generally recommended for WordPress files to ensure security while allowing the web server to read them?
A644
B600
C777
D755
Attempts:
2 left
💡 Hint
Think about permissions that allow reading but restrict writing by others.
❓ component_behavior
intermediate
2:00remaining
Effect of incorrect directory permissions in WordPress
If WordPress directories are set to permission 644 instead of the recommended 755, what is the most likely outcome?
AWordPress will fail to upload media files or install plugins due to lack of execute permission on directories.
BWordPress will work normally without any issues.
CWordPress files will become publicly writable, causing security risks.
DWordPress will automatically correct the permissions to 755.
Attempts:
2 left
💡 Hint
Directories need execute permission to allow access inside them.
📝 Syntax
advanced
2:00remaining
Correct .htaccess rule to prevent PHP execution in uploads
Which of the following .htaccess snippets correctly prevents execution of PHP files inside the wp-content/uploads directory?
A
<Files *.php>
  Require all denied
</Files>
B
<Files *.php>
  deny from all
</Files>
C
<FilesMatch "\.php$">
  deny from all
</FilesMatch>
D
<FilesMatch "\.php$">
  Require all denied
</FilesMatch>
Attempts:
2 left
💡 Hint
Modern Apache versions use 'Require all denied' for access control.
🔧 Debug
advanced
2:00remaining
Diagnosing permission error during plugin update
A WordPress site shows a 'Could not create directory' error when updating plugins. The wp-content/plugins directory has permissions 755 and is owned by root. What is the most likely cause?
AThe plugins directory is missing execute permission.
BThe directory permissions 755 are too restrictive; it should be 777.
CThe directory ownership by root prevents the web server user from writing to it.
DThe WordPress configuration file is corrupted.
Attempts:
2 left
💡 Hint
Check who owns the directory and which user runs the web server.
❓ state_output
expert
2:00remaining
Result of applying restrictive permissions on wp-config.php
If the wp-config.php file is set to permission 400 (read-only by owner) and owned by the web server user, what will be the effect on WordPress operation?
AWordPress will fail to load because it cannot write to wp-config.php.
BWordPress will function normally, as it only needs to read wp-config.php.
CWordPress will throw a permission denied error when updating plugins.
DWordPress will automatically change the permission to 644.
Attempts:
2 left
💡 Hint
Consider if WordPress needs to write to wp-config.php during normal operation.

Practice

(1/5)
1. What is the main purpose of file permission hardening in WordPress?
easy
A. To add more plugins automatically
B. To speed up the website loading time
C. To protect the site from unauthorized changes
D. To change the website theme

Solution

  1. Step 1: Understand file permission hardening

    File permission hardening means setting rules on who can read, write, or execute files to keep the site safe.
  2. Step 2: Identify the main goal

    The goal is to stop unauthorized users from changing files, which protects the site from harm.
  3. Final Answer:

    To protect the site from unauthorized changes -> Option C
  4. Quick Check:

    File permission hardening = Protect site [OK]
Hint: Think security first: permissions stop unwanted changes [OK]
Common Mistakes:
  • Confusing permission hardening with performance tuning
  • Thinking it adds features like plugins or themes
  • Believing it changes website design
2. Which chmod command correctly sets safe permissions for WordPress files?
easy
A. chmod 777 wp-config.php
B. chmod 644 index.php
C. chmod 000 wp-content
D. chmod 222 wp-admin

Solution

  1. Step 1: Recall safe file permissions

    Files should be readable and writable by the owner, readable by others, usually 644.
  2. Step 2: Check each option

    chmod 644 index.php sets 644 on a file, which is safe. Others either give too many rights or none.
  3. Final Answer:

    chmod 644 index.php -> Option B
  4. Quick Check:

    Safe file permission = 644 [OK]
Hint: Files usually get 644 permission, not 777 or 000 [OK]
Common Mistakes:
  • Using 777 which is too open and unsafe
  • Setting 000 which blocks all access
  • Confusing file and folder permissions
3. Given the command chmod 755 wp-content, what is the effect on the wp-content folder?
medium
A. Owner can read, write, execute; others can read and execute only
B. Everyone can read, write, and execute the folder
C. No one has any permissions on the folder
D. Only the owner can read, write, and execute; others have no access

Solution

  1. Step 1: Understand permission digits 755

    7 means owner can read(4), write(2), execute(1) = 7; 5 means others can read(4) and execute(1) = 5.
  2. Step 2: Apply to wp-content folder

    Owner has full rights; others can read and execute but not write.
  3. Final Answer:

    Owner can read, write, execute; others can read and execute only -> Option A
  4. Quick Check:

    755 = Owner full, others read+execute [OK]
Hint: 755 means owner full, others read+execute only [OK]
Common Mistakes:
  • Thinking 755 allows others to write
  • Confusing execute permission with write
  • Assuming no access for others
4. You set chmod 777 wp-config.php to fix a permission error, but the site becomes vulnerable. What is the problem?
medium
A. 777 allows anyone to read, write, and execute the file, risking security
B. 777 blocks all access to the file
C. 777 only allows the owner to access the file
D. 777 is the recommended permission for wp-config.php

Solution

  1. Step 1: Understand what 777 permission means

    It gives read, write, and execute rights to everyone, including strangers.
  2. Step 2: Assess security risk for wp-config.php

    This file holds sensitive info; open permissions let attackers change or read it.
  3. Final Answer:

    777 allows anyone to read, write, and execute the file, risking security -> Option A
  4. Quick Check:

    777 = Full access for all = Risk [OK]
Hint: Never use 777 on sensitive files like wp-config.php [OK]
Common Mistakes:
  • Thinking 777 restricts access
  • Believing 777 is safe for config files
  • Confusing execute with write permission
5. To secure wp-config.php, which permission setting is best to prevent unauthorized reading but allow WordPress to function?
hard
A. chmod 644 wp-config.php
B. chmod 777 wp-config.php
C. chmod 000 wp-config.php
D. chmod 400 wp-config.php

Solution

  1. Step 1: Understand wp-config.php security needs

    This file contains database passwords and keys, so it must be protected from others.
  2. Step 2: Evaluate permission options

    400 means only owner can read; WordPress runs as owner, so it works. 644 allows others to read, 777 is too open, 000 blocks all access.
  3. Final Answer:

    chmod 400 wp-config.php -> Option D
  4. Quick Check:

    400 = Owner read only = Secure [OK]
Hint: Use 400 to lock wp-config.php to owner read only [OK]
Common Mistakes:
  • Using 644 which lets others read sensitive info
  • Using 777 which is insecure
  • Using 000 which breaks WordPress access
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