Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

What is: chmod

chmod (change mode) is a Linux command that is used to control access to files and folders on your web hosting server.

Imagine your WordPress website as a building with different rooms. chmod acts like a keycard system, allowing you to decide who can enter and what they can do inside each room (folder) and with each item (file) within your website.

You typically won’t need to directly use the chmod command yourself. Most web hosting providers offer user-friendly interfaces like cPanel, File Manager, or FTP clients that allow you to adjust WordPress file permissions visually.

However, understanding chmod can give you a better grasp of how your WordPress website is secured and functions behind the scenes.

What Is Chmod in WordPress

What Does chmod Do in WordPress?

While most web hosting providers offer user-friendly interfaces to manage file permissions, there are situations where understanding chmod can be beneficial for WordPress users.

Mainly, you can use chmod to troubleshoot permission issues. Sometimes, WordPress plugins or themes might not function correctly due to incorrect file permissions.

Technically, FTP clients like FileZilla can achieve the same thing, but chmod can be good for people who are more comfortable with using a command line interface.

Furthermore, some FTP clients might offer checkboxes or dropdown menus for read, write, and execute file and folder permissions. But they might not allow setting individual permissions for owner, group, and others.

Having access to these individual permissions will be necessary for cases like granting a plugin write access to update itself, but restricting its ability to execute scripts within sensitive core WordPress directories, like wp-includes.

How Does the chmod Command Affect WordPress Security?

The chmod command can affect your WordPress site’s security by restricting unauthorized access.

By setting appropriate permissions, you can prevent unauthorized users or processes from accessing sensitive files likewp-config.php (which contains database credentials).

This significantly reduces the risk of someone hacking into your site and causing damage.

Furthermore, if you do a manual WordPress installation, it’s recommended to use chmod to adjust file permissions and make them more secure. This is because WordPress hosting providers typically won’t do it for you unless you use the one-click installer.

Manually installing WordPress

You can also use chmod to prevent plugins or themes from writing to areas where they shouldn’t. For instance, you wouldn’t want a plugin to have write access to the .htaccess file, which controls server behavior.

By restricting write access, you make it more difficult for malware to infiltrate your site through vulnerabilities in plugins or themes.

Finally, WordPress requires certain files and folders to be writable by the web server process for updates and functionality. Using chmod ensures these files have the necessary permissions to function properly while keeping others secure.

That being said, using chmod incorrectly can potentially compromise your website’s security.

It’s recommended to only change file permissions if you truly know what you’re doing. For most everyday tasks, FTP clients or the file manager offered by your web hosting provider will be enough.

What Is the Correct chmod Permission for WordPress?

For most WordPress files, the recommended permission is chmod 644. This grants read access to everyone, write access to the owner (usually the web server process), and no access to others.

Folders within your WordPress installation typically require the following command: chmod 755 . This allows the web server process to read, write, and execute files within the directory while restricting access for others.

For the wp-config.phpfile, it’s recommended to set permissions to 444 or 400. These permissions grant read access only to the owner (the web server process) and prevent any modifications, even by the web server itself.

Make sure that you know the correct permissions for files and folders before you edit them. For more information, check out our beginner’s guide to WordPress files and directories.

How to Use the chmod Command to Set File Permissions in WordPress

To use the chmod Command, you will need to connect to your WordPress blog or site’s server remotely using SSH (Secure Shell).

There are various SSH client applications available depending on your operating system. For Windows, PuTTY is a popular free SSH client. On the other hand, most macOS and Linux distributions come with a built-in SSH client accessible through the terminal.

You’ll also need your SSH credentials provided by your WordPress hosting provider. These typically include a username, password, and server address.

PuTTY Settings

Once connected via SSH, you can use the chmod command to modify file permissions.

Let’s use an example. Say you want to grant write permissions to a specific WordPress plugin file (custom-plugin.php) located within the wp-content folder on your website. The recommended permission for most plugin files is 644 .

You can enter this chmod command into the SSH client’s command line interface:

chmod 644 /public_html/wp-content/plugins/custom-plugin.php

You won’t typically get a response from the command itself when using chmod successfully. If there’s an error during the chmod operation, then you’ll see an error message in the command line.

We hope this article helped you learn more about chmod in WordPress. You may also want to see our Additional Reading list below for related articles on useful WordPress tips, tricks, and ideas.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Additional Reading

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!