{"id":13996,"date":"2009-05-21T14:30:24","date_gmt":"2009-05-21T21:30:24","guid":{"rendered":"http:\/\/ben.akrin.com\/?p=7"},"modified":"2009-05-21T14:30:24","modified_gmt":"2009-05-21T21:30:24","slug":"7","status":"publish","type":"post","link":"https:\/\/ben.akrin.com\/?p=13996","title":{"rendered":"recursive type based chmod"},"content":{"rendered":"<p>Here&#8217;s a cool little script that will recursively chmod, giving a permission based on whether it&#8217;s dealing with a file or a directory. This is very convenient when you want to add that +x to directories but not files.<\/p>\n<p>[bash]find $1 -type f -exec chmod $2 {} ;<br \/>\nfind $1 -type d -exec chmod $3 {} ;[\/bash]<\/p>\n<p>Go ahead and edit \/usr\/bin\/chmod_script, copy paste these 2 lines in there, then issue a chmod 755 \/usr\/bin\/chmod_script as root, that&#8217;s it!<\/p>\n<p>Usage syntax is as follows:<\/p>\n<p>[bash]chmod_script &lt;directory_to_start_the_recursion_in&gt; &lt;permissions_for_files&gt; &lt;permissions_for+directories&gt;[\/bash]<\/p>\n<p>so if I want to use it on \/var\/www do:<\/p>\n<p>[code]chmod_script \/var\/www 644 755[\/code]<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a cool little script that will recursively chmod, giving a permission based on whether it&#8217;s dealing with a file or a directory. This is very convenient when you want to add that +x to directories but not files. [bash]find $1 -type f -exec chmod $2 {} ; find $1 -type d -exec chmod $3 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ben.akrin.com\/?p=13996\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;recursive type based chmod&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,18],"tags":[],"class_list":["post-13996","post","type-post","status-publish","format-standard","hentry","category-i-t","category-unix-linux"],"_links":{"self":[{"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/posts\/13996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13996"}],"version-history":[{"count":0,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=\/wp\/v2\/posts\/13996\/revisions"}],"wp:attachment":[{"href":"https:\/\/ben.akrin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ben.akrin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}