{"id":373,"date":"2010-06-15T12:04:57","date_gmt":"2010-06-15T17:04:57","guid":{"rendered":"http:\/\/www.ryanbelanger.com\/?p=3"},"modified":"2010-06-15T12:04:57","modified_gmt":"2010-06-15T17:04:57","slug":"wordpress-file-permissions","status":"publish","type":"post","link":"https:\/\/ryanbelanger.com\/?p=373","title":{"rendered":"WordPress file permissions in Plesk"},"content":{"rendered":"<p>According to: <a href=\"http:\/\/codex.wordpress.org\/Changing_File_Permissions\">http:\/\/codex.wordpress.org\/Changing_File_Permissions<\/a><\/p>\n<p>[pullquote]All files should be owned by your user account on your web server, and should be writable by your username. Any file that needs write access from WordPress should be group-owned by the user account used by the webserver.[\/pullquote]<\/p>\n<p>Related information:\u00a0<a href=\"http:\/\/codex.wordpress.org\/Updating_WordPress#Automatic_Update\">http:\/\/codex.wordpress.org\/Updating_WordPress#Automatic_Update<\/a><\/p>\n<p>On plesk, &#8220;your user account&#8221; is set in the admin interface (Domain&gt;web hosting setup&gt;Ftp user). The webserver user account is <strong>apache<\/strong> and the standard group of which apache is member is psaserv. Unfortunately, plesk&#8217;s default setup configures the ftp server to upload files as the correct user but as group &#8220;psacln&#8221; and does not give the group write permissions to the files. Here is a quick fix to correct this behavior. (You will need root access to do these changes).<\/p>\n<p>1- Edit <strong>\/etc\/proftpd.conf<\/strong>and change line &#8220;Umask 022&#8221; to:<\/p>\n<pre class=\"brush: bash\">Umask 002<\/pre>\n<p>This will give write access to the psacln group when new files are uploaded via FTP.<\/p>\n<p>2- Add the webserver account to the psacln group by editing <strong>\/etc\/group<\/strong>. Change line &#8220;psacln:x:2522:&#8221; to:<\/p>\n<pre class=\"brush: bash\">psacln:x:2522:apache<\/pre>\n<p>Just add <strong>apache<\/strong> to the end of the line. 2522 is the group ID and will differ on each server, <span style=\"text-decoration: underline;\"><br \/>\nleave yours as is<\/span>. If there is already a username after the last &#8220;:&#8221;, add a comma and then apache (psacln:x:2522:user1,apache). You could refer <a href=\"http:\/\/www.cyberciti.biz\/faq\/understanding-etcgroup-file\/\">here<\/a> if you want more info on the group file structure.<\/p>\n<p>3- Make sure php <strong>safe mode\u00a0<\/strong>is OFF. In plesk admin &#8220;domain&gt;web hosting setup&gt;php support&#8221;, &#8220;PHP &#8216;safe_mode&#8217; on&#8221; must be unchecked. WordPress does not require PHP to be in safe-mode, Plesk does because the webserver runs as user apache and the files ca be uploaded\/updated either as the ftp user (updates) or as apache (media additions). Plesk&#8217;s application Vault lists safe mode off as one of WordPress&#8217;s requirements.<\/p>\n<p><a href=\"https:\/\/www.ryanbelanger.com\/wp-content\/uploads\/2010\/06\/WordPress-Plesk-Requirements.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-346\" title=\"WordPress Plesk Requirements\" src=\"https:\/\/www.ryanbelanger.com\/wp-content\/uploads\/2010\/06\/WordPress-Plesk-Requirements.jpg\" alt=\"\" width=\"969\" height=\"477\" \/><\/a><\/p>\n<p>4- Reload apache:<\/p>\n<pre class=\"brush: bash\">service httpd restart<\/pre>\n<p>Done<\/p>\n<p>To fix an already installed wordpress which was uploaded before these changes were made, follow these steps:<\/p>\n<pre class=\"brush: bash\">cd \/var\/www\/vhosts\/yourdomain.com\nchown -R youruser:psacln httpdocs\nchmod -R g+w httpdocs\/wp-content\nfind httpdocs -type d -exec chmod g+s {} \\;<\/pre>\n<p>The last part (chmod g+s) sets the &#8220;s&#8221; flag to all directories. This is necessary so any folders or files created within these directories will have the folder&#8217;s group owner.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>According to: http:\/\/codex.wordpress.org\/Changing_File_Permissions [pullquote]All files should be owned by your user account on your web server, and should be writable by your username. Any file that needs write access from WordPress should be group-owned by the user account used by the webserver.[\/pullquote] Related information:\u00a0http:\/\/codex.wordpress.org\/Updating_WordPress#Automatic_Update On plesk, &#8220;your user account&#8221; is set in the admin interface [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[16,21,27],"class_list":["post-373","post","type-post","status-publish","format-standard","hentry","category-tips","tag-linux","tag-plesk","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=\/wp\/v2\/posts\/373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=373"}],"version-history":[{"count":0,"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=\/wp\/v2\/posts\/373\/revisions"}],"wp:attachment":[{"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ryanbelanger.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}