{"id":390,"date":"2014-01-15T11:43:51","date_gmt":"2014-01-15T17:43:51","guid":{"rendered":"http:\/\/www.marcblase.com\/blog\/?p=390"},"modified":"2014-03-25T15:20:24","modified_gmt":"2014-03-25T20:20:24","slug":"how-to-chmod-web-files-properly","status":"publish","type":"post","link":"https:\/\/ma.rcbla.se\/blog\/2014\/01\/how-to-chmod-web-files-properly\/","title":{"rendered":"How to CHMOD web files properly"},"content":{"rendered":"<p>To change all the directories to 755 (-rwxr-xr-x):<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">find \/path\/to\/web\/dir -type d -exec chmod 755 {} \\;<\/pre>\n<p>To change all the files to 644 (-rw-r&#8211;r&#8211;):<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">find \/path\/to\/web\/dir -type f -exec chmod 644 {} \\;<\/pre>\n<p>chmod 644 {} \\; specifies the command that will be executed by find for each file. {} is replaced by the file path, and the semicolon denotes the end of the command (escaped, otherwise it would be interpreted by the shell instead of find).<\/p>\n<p>or alternatively, you could do the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">chmod -R a+rX .\/*<\/pre>\n<p>The X (that is capital X, not small x!) is ignored for files (unless they are executable for someone already) but is used for directories.<\/p>\n<p><small>Thanks for the answers once again <a href=\"http:\/\/stackoverflow.com\/questions\/3740152\/how-to-set-chmod-for-a-folder-and-all-of-its-subfolders-and-files-in-linux-ubunt\">Stack Overflow<\/a>.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To change all the directories to 755 (-rwxr-xr-x): find \/path\/to\/web\/dir -type d -exec chmod 755 {} \\; To change all the files to 644 (-rw-r&#8211;r&#8211;): find \/path\/to\/web\/dir -type f -exec chmod 644 {} \\; chmod 644 {} \\; specifies the command that will be executed by find for each file. {} is replaced by the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51,3],"tags":[],"class_list":["post-390","post","type-post","status-publish","format-standard","hentry","category-cli","category-discoveries"],"_links":{"self":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/comments?post=390"}],"version-history":[{"count":3,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/390\/revisions"}],"predecessor-version":[{"id":393,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/390\/revisions\/393"}],"wp:attachment":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/media?parent=390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/categories?post=390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/tags?post=390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}