{"id":3426,"date":"2024-05-23T17:56:17","date_gmt":"2024-05-23T12:26:17","guid":{"rendered":"https:\/\/www.veeble.org\/kb\/?p=3426"},"modified":"2025-04-09T12:43:14","modified_gmt":"2025-04-09T07:13:14","slug":"correct-permissions-for-wordpress-files-and-directories","status":"publish","type":"post","link":"https:\/\/www.veeble.com\/kb\/correct-permissions-for-wordpress-files-and-directories\/","title":{"rendered":"Correct Permissions for WordPress Files and Directories"},"content":{"rendered":"\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Linux-Symbol-1.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"463\" data-id=\"3428\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Linux-Symbol-1.jpg\" alt=\"Correct Permissions of WordPress Files and Directories\" class=\"wp-image-3428\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Linux-Symbol-1.jpg 1200w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Linux-Symbol-1-300x116.jpg 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Linux-Symbol-1-1024x395.jpg 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Linux-Symbol-1-768x296.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n<\/figure>\n\n\n\n<p>Setting the right file permissions for your WordPress files and directories is crucial for maintaining its security and functionality. Incorrect permissions can leave your site vulnerable to hackers or cause issues with running WordPress. This guide will walk you through the correct permissions for WordPress files and directories via cPanel and Linux shell.<\/p>\n\n\n\n<pre class=\"wp-block-verse\">Before you read this tutorial, please checkout: <a href=\"https:\/\/www.veeble.org\/kb\/linux-file-permissions\/\" target=\"_blank\" rel=\"noopener\">Linux Permissions Explained<\/a><\/pre>\n\n\n\n<p><\/p>\n\n\n<h4 class=\"wp-block-heading\" id=\"wordpress-directories\">WordPress Directories<\/h4>\n\n\n<p>For WordPress directories, the recommended permission is <strong>755<\/strong>.<br>In other words; the owner can read, write, and execute. The <a href=\"https:\/\/www.javatpoint.com\/linux-groups\" target=\"_blank\" rel=\"noopener\">group<\/a> and other users can read and execute.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-veeble-hosting wp-block-embed-veeble-hosting\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.veeble.org\/kb\/what-do-chmod-755-644-and-others-mean\n<\/div><\/figure>\n\n\n\n<p><strong>To set this permission for all WordPress directories via Linux shell, you can use the &#8220;<a href=\"https:\/\/www.veeble.org\/kb\/how-to-find-files-containing-specific-text-in-linux\/#:~:text=grep%20%2Drli%20%27your_text%27%20.-,Find%20Command,-How%20to%20Find\" target=\"_blank\" rel=\"noopener\">find command<\/a>&#8220;:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>find \/path\/to\/your\/wordpress\/ -type d -exec chmod 755 {} \\;<\/code><\/pre>\n\n\n\n<p><em>Replace the &#8220;\/path\/to\/your\/wordpress\/&#8221; with the exact path of your WordPress installation.<\/em><\/p>\n\n\n\n<p>Example Screenshot:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-173800.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1112\" height=\"53\" data-id=\"3446\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-173800.png\" alt=\"Using Find Command in Linux to set correct permission for WordPress directories\" class=\"wp-image-3446\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-173800.png 1112w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-173800-300x14.png 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-173800-1024x49.png 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-173800-768x37.png 768w\" sizes=\"auto, (max-width: 1112px) 100vw, 1112px\" \/><\/a><\/figure>\n<\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>To set 755 permission via cPanel;<\/strong><br><br>Locate the &#8220;File Manager&#8221; option in the &#8220;Files&#8221; section on your cPanel account followed by navigating to the directory where your WordPress installation is. <br>Then right-click on the directory you need to change permission (e.g., <code>wp-content<\/code>, <code>wp-includes<\/code>).<br>Select &#8220;Change Permissions.&#8221; from the popup and set the permissions to <strong>755<\/strong>. After all, click &#8220;Change Permissions.&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/p-dir.gif\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1884\" height=\"888\" data-id=\"3434\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/p-dir.gif\" alt=\"How to change permissions of a folder via Cpanel?\" class=\"wp-image-3434\"\/><\/a><\/figure>\n<\/figure>\n\n\n\n<p><\/p>\n\n\n<h4 class=\"wp-block-heading\" id=\"wordpress-files\">WordPress Files<\/h4>\n\n\n<p>For WordPress files, the recommended permission is <strong>644<\/strong>. <br>This means the owner can read and write. And group and other users can just read the file.<\/p>\n\n\n\n<p><strong>To set this permission for all files using a Linux shell, you can use the following command:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>find \/path\/to\/your\/wordpress\/ -type f -exec chmod 644 {} \\;<\/code><\/pre>\n\n\n\n<p><em>Replace the &#8220;\/path\/to\/your\/wordpress\/&#8221; with the exact path of your WordPress installation.<\/em><\/p>\n\n\n\n<p>Example Screenshot:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-174025.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1117\" height=\"54\" data-id=\"3449\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-174025.png\" alt=\"Using Find Command in Linux to set correct permission for WordPress files\" class=\"wp-image-3449\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-174025.png 1117w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-174025-300x15.png 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-174025-1024x50.png 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-174025-768x37.png 768w\" sizes=\"auto, (max-width: 1117px) 100vw, 1117px\" \/><\/a><\/figure>\n<\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>In the same way, we changed permissions earlier for a directory in cPanel, a file permission can be also modified in cPanel:<\/strong><br><br>Locate the &#8220;File Manager&#8221; option in the &#8220;Files&#8221; section on your cPanel account followed by navigating to the directory where your WordPress installation is. <br>Then right-click on the file you need to change permission (e.g., <code>index.php<\/code>).<br>Select &#8220;Change Permissions.&#8221; from the popup and set the permissions to <strong>755<\/strong>. After all, click &#8220;Change Permissions.&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/file.gif\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1884\" height=\"888\" data-id=\"3436\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/file.gif\" alt=\"Change file permission in cpanel\" class=\"wp-image-3436\"\/><\/a><\/figure>\n<\/figure>\n\n\n\n<p><\/p>\n\n\n<h4 class=\"wp-block-heading\" id=\"special-files-and-directories\">Special Files and Directories<\/h4>\n\n\n<p>There are some files and directories that need different permission settings in order to work correctly and securely.<br><br><strong>wp-config.php<\/strong><br><br>The <code>wp-config.php<\/code> file contains sensitive information about your WordPress installation. It should have stricter permissions.<br>The recommended permission is <strong>440<\/strong> or <strong>400<\/strong><br>That means the User can have read, write, and execute permissions, and group and others lack any permissions.<br><br>Use one of the following commands in the Linux shell to set these permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 440 \/path\/to\/your\/wordpress\/wp-config.php<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center\">OR<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 400 \/path\/to\/your\/wordpress\/wp-config.php<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Uploads Directory<\/strong><br><br>The <code>wp-content\/uploads<\/code> directory might need slightly different permissions to allow file uploads.<br>Typically, <strong>755<\/strong> should work, but if you encounter issues, you might need to change it to <strong>775<\/strong> which is supposed to give user and group full permissions (read, write, execute) and other users; read and execute.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod -R 775 \/path\/to\/your\/wordpress\/wp-content\/uploads<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n<h4 class=\"wp-block-heading\" id=\"file-and-directory-permissions-table\">File and Directory Permissions Table<\/h4>\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>File\/Directory<\/th><th>Permission<\/th><\/tr><\/thead><tbody><tr><td>Root directory (WordPress installation directory : usually public_html)<\/td><td>755 or 750<\/td><\/tr><tr><td>wp-admin<\/td><td>755<\/td><\/tr><tr><td>wp-includes<\/td><td>755<\/td><\/tr><tr><td>wp-content<\/td><td>755<\/td><\/tr><tr><td>wp-content\/themes<\/td><td>755<\/td><\/tr><tr><td>wp-content\/plugins<\/td><td>755<\/td><\/tr><tr><td>wp-content\/uploads<\/td><td>755<\/td><\/tr><tr><td>wp-content\/languages<\/td><td>755<\/td><\/tr><tr><td>wp-content\/mu-plugins<\/td><td>755<\/td><\/tr><tr><td>wp-content\/upgrade<\/td><td>755<\/td><\/tr><tr><td>wp-content\/cache<\/td><td>755<\/td><\/tr><tr><td>.htaccess<\/td><td>644<\/td><\/tr><tr><td>index.php<\/td><td>644<\/td><\/tr><tr><td>wp-config.php<\/td><td>400 or 440<\/td><\/tr><tr><td>wp-cron.php<\/td><td>644<\/td><\/tr><tr><td>wp-load.php<\/td><td>644<\/td><\/tr><tr><td>wp-login.php<\/td><td>644<\/td><\/tr><tr><td>wp-mail.php<\/td><td>644<\/td><\/tr><tr><td>wp-settings.php<\/td><td>644<\/td><\/tr><tr><td>wp-signup.php<\/td><td>644<\/td><\/tr><tr><td>wp-activate.php<\/td><td>644<\/td><\/tr><tr><td>wp-blog-header.php<\/td><td>644<\/td><\/tr><tr><td>xmlrpc.php<\/td><td>644<\/td><\/tr><tr><td>license.txt<\/td><td>644<\/td><\/tr><tr><td>readme.html<\/td><td>644<\/td><\/tr><tr><td>wp-links-opml.php<\/td><td>644<\/td><\/tr><tr><td>wp-trackback.php<\/td><td>644<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>By setting these permissions, you ensure that WordPress can manage your media files properly while maintaining security.<\/p>\n\n\n\n<div style=\"height:45px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-uagb-call-to-action uagb-block-bec950e6 wp-block-button\"><div class=\"uagb-cta__wrap\"><h3 class=\"uagb-cta__title\">Take Control of Your Hosting<\/h3><p class=\"uagb-cta__desc\">Root access, dedicated resources, and scalable solutions. Our KVM VPS puts you in the driver&#8217;s seat.<\/p><\/div><div class=\"uagb-cta__buttons\"><a href=\"https:\/\/www.veeble.com\/in\/kvm-vps\/\" class=\"uagb-cta__button-link-wrapper wp-block-button__link\" target=\"_blank\" rel=\"noopener noreferrer\">Choose Your Plan<svg xmlns=\"https:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path d=\"M504.3 273.6l-112.1 104c-6.992 6.484-17.18 8.218-25.94 4.406c-8.758-3.812-14.42-12.45-14.42-21.1L351.9 288H32C14.33 288 .0002 273.7 .0002 255.1S14.33 224 32 224h319.9l0-72c0-9.547 5.66-18.19 14.42-22c8.754-3.809 18.95-2.075 25.94 4.41l112.1 104C514.6 247.9 514.6 264.1 504.3 273.6z\"><\/path><\/svg><\/a><\/div><\/div>\n\n\n\n<div style=\"height:45px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Also Read:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-veeble-hosting wp-block-embed-veeble-hosting\" style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.veeble.org\/kb\/linux-file-permissions\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Setting the right file permissions for your WordPress files and directories is crucial for maintaining its security and functionality. Incorrect permissions can leave your [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":8531,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[29,5],"tags":[],"class_list":["post-3426","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-linux"],"uagb_featured_image_src":{"full":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Correct-Permissions-for-WordPress-Files-and-Directories.jpg",1536,1024,false],"thumbnail":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Correct-Permissions-for-WordPress-Files-and-Directories-150x150.jpg",150,150,true],"medium":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Correct-Permissions-for-WordPress-Files-and-Directories-300x200.jpg",300,200,true],"medium_large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Correct-Permissions-for-WordPress-Files-and-Directories-768x512.jpg",768,512,true],"large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Correct-Permissions-for-WordPress-Files-and-Directories-1024x683.jpg",1024,683,true],"1536x1536":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Correct-Permissions-for-WordPress-Files-and-Directories.jpg",1536,1024,false],"2048x2048":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Correct-Permissions-for-WordPress-Files-and-Directories.jpg",1536,1024,false]},"uagb_author_info":{"display_name":"Adrian Antony","author_link":"https:\/\/www.veeble.com\/kb\/author\/adrian\/"},"uagb_comment_info":0,"uagb_excerpt":"Setting the right file permissions for your WordPress files and directories is crucial for maintaining its security and functionality. Incorrect permissions can leave your [&hellip;]","_links":{"self":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/comments?post=3426"}],"version-history":[{"count":23,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3426\/revisions"}],"predecessor-version":[{"id":7375,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3426\/revisions\/7375"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media\/8531"}],"wp:attachment":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media?parent=3426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/categories?post=3426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/tags?post=3426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}