0
0
Wordpressframework~10 mins

File permission hardening in Wordpress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the correct file permission for a WordPress configuration file.

Wordpress
chmod('wp-config.php', intval([1], 8));
Drag options to blanks, or click blank then click option'
A0666
B0777
C0644
D0755
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0777 makes the file writable by everyone, which is insecure.
2fill in blank
medium

Complete the code to set the correct directory permission for WordPress content folders.

Wordpress
chmod('wp-content/uploads', intval([1], 8));
Drag options to blanks, or click blank then click option'
A0755
B0777
C0644
D0666
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0644 on directories prevents access to files inside.
3fill in blank
hard

Fix the error in the code that sets file permissions for all PHP files in the theme folder.

Wordpress
foreach (glob('wp-content/themes/mytheme/*.php') as $file) {
    chmod($file, intval([1], 8));
}
Drag options to blanks, or click blank then click option'
A0644
B0666
C0755
D0777
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0755 makes PHP files executable, which is unnecessary and risky.
4fill in blank
hard

Fill both blanks to set secure permissions for WordPress core files and directories.

Wordpress
chmod('wp-admin', intval([1], 8));
chmod('index.php', intval([2], 8));
Drag options to blanks, or click blank then click option'
A0755
B0644
C0777
D0666
Attempts:
3 left
💡 Hint
Common Mistakes
Setting 0777 on files or directories exposes security risks.
5fill in blank
hard

Fill all three blanks to create a secure permissions setup for WordPress uploads folder and its files.

Wordpress
chmod('wp-content/uploads', intval([1], 8));
foreach (glob('wp-content/uploads/*') as $item) {
    if (is_dir($item)) {
        chmod($item, intval([2], 8));
    } else {
        chmod($item, intval([3], 8));
    }
}
Drag options to blanks, or click blank then click option'
A0755
B0644
C0777
D0666
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0777 makes files and folders writable by anyone, which is unsafe.