{"id":117969,"date":"2023-04-26T15:03:22","date_gmt":"2023-04-26T14:03:22","guid":{"rendered":"https:\/\/wpsimplefix.com\/?p=117969"},"modified":"2026-09-24T17:41:51","modified_gmt":"2026-09-24T17:41:51","slug":"how-to-change-file-permissions","status":"publish","type":"post","link":"https:\/\/chkserv.com\/blog\/how-to-change-file-permissions\/","title":{"rendered":"How to change file permissions?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Setting file permissions in WordPress is a crucial but frequently forgotten chore. On your server, they control who has access to read, write, and execute files. For your website to function properly and securely in WordPress, they must be properly specified.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Through the command line, WordPress users can modify file permissions. If you have access to your server and want to quickly change them for numerous files or folders, use this method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are the file permissions?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The default file permissions for a WordPress installation should be set to ensure maximum security, and the recommended file values are usually set as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Root directory (\/): <code>755<\/code>\n<ul class=\"wp-block-list\">\n<li>\/wp-admin\/: <code>755<\/code><\/li>\n\n\n\n<li>\/wp-includes\/: <code>755<\/code><\/li>\n\n\n\n<li>\/wp-content\/: <code>755<\/code>\n<ul class=\"wp-block-list\">\n<li>\/wp-content\/themes\/: <code>755<\/code><\/li>\n\n\n\n<li>\/wp-content\/plugins\/: <code>755<\/code><\/li>\n\n\n\n<li>\/wp-content\/uploads\/: <code>755<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>.htaccess: <code>644<\/code><\/li>\n\n\n\n<li>index.php: <code>644<\/code><\/li>\n\n\n\n<li>wp-config.php: <code>640<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">These settings provide the necessary read and write access for the server and web server process, while restricting write access for other users. Some <a href=\"\/blog\/blog\/category\/plugins\/\">plugins<\/a> and <a href=\"\/blog\/blog\/category\/themes\/\">themes<\/a> may require different permissions for specific files, but it\u2019s important to ensure that sensitive files such as wp-config.php are set to read-only (640) to prevent unauthorized access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s important to note that file permissions can vary depending on the server environment and hosting setup, so it\u2019s best to consult with your hosting provider or a WordPress expert if you\u2019re unsure about the proper settings for your site.<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">How?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are several ways to change WordPress file permissions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><p>Via File Manager in <a href=\"https:\/\/cpanel.net\" target=\"_blank\" rel=\"nofollow noopener\">cPanel<\/a>: \u00a0Simply log in to cPanel, navigate to File Manager, locate the file or directory you want to change permissions for, right-click on it and select \u201cChange Permissions.\u201d Then, set the desired permissions using the checkboxes or numeric value.<\/p><\/li>\n\n\n\n<li><p>Via FTP or SFTP client: You can use a client, such as <a href=\"https:\/\/filezilla-project.org\" target=\"_blank\" rel=\"noopener\">FileZilla<\/a>, to connect to your WordPress site and change file values. Locate the file or directory you want to change permissions for, right-click on it, and select \u201cFile permissions.\u201d Then, set the desired values using numeric only.<\/p><\/li>\n\n\n\n<li><p>Via the Command Line (SSH): If you have SSH access to your server, you can change file permissions using the command line. Connect to your server using an SSH client, navigate to the WordPress directory, and use the chmod command to change them.<\/p><\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">For example, to set the permissions of the wp-config.php file to 640, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-1\"><code readonly=\"true\"><xmp>chmod 640 wp-config.php<\/xmp><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To set the permissions of the wp-content directory to 755, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-2\"><span style=\"font-size: inherit; background-color: rgba(255, 255, 255, 0.2);\">chmod 755 wp-content<\/span><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Step 4: Verify file permissions. After setting them, it&#8217;s important to verify that the permissions were set correctly. To do this, use the <strong>ls -l<\/strong> command to view the permissions of the files or directories you modified.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">To view the permissions of the wp-config.php file, you would use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-3\"><span style=\"font-size: inherit; background-color: rgba(255, 255, 255, 0.2);\">ls -l wp-config.php<\/span><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The output should show the permissions of the file in the following format:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-4\"><code readonly=\"true\">-rw-r--r-- 1 user group 2810 Apr 15 2023 wp-config.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first column represents the file permissions, followed by the owner and group of the file, the file size ( in bytes ), and the date the file was modified.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In conclusion, using the command line to adjust file permissions in <a href=\"\/blog\/blog\/category\/wordpress\/\">WordPress<\/a> is a quick and effective way to make sure that your website functions properly and is secure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can quickly adjust file permissions for your WordPress installation by following these instructions, and you can also check to see if the rights were set correctly. Be cautious when changing permissions, as improper settings can break your site or leave it vulnerable to <a href=\"https:\/\/chkserv.com\/blog\/blog\/improve-wordpress-security\/\">security<\/a> exploits.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting file permissions in WordPress is a crucial but frequently forgotten chore. On your server, they control who has access to read, write, and execute files. For your website to function properly and securely in WordPress, they must be properly specified. Through the command line, WordPress users can modify file permissions. If you have access [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":121194,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[98,99,100,9,101,23,102,103,104,92],"class_list":["post-117969","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hosting","tag-98","tag-99","tag-chmod","tag-file","tag-folder","tag-hosting","tag-ls-l","tag-permission","tag-permissions","tag-server"],"_links":{"self":[{"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/posts\/117969","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/comments?post=117969"}],"version-history":[{"count":2,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/posts\/117969\/revisions"}],"predecessor-version":[{"id":136699,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/posts\/117969\/revisions\/136699"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/media\/121194"}],"wp:attachment":[{"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/media?parent=117969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/categories?post=117969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/tags?post=117969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}