{"id":5218,"date":"2023-07-17T06:34:01","date_gmt":"2023-07-17T06:34:01","guid":{"rendered":"https:\/\/arzhost.com\/blogs\/?p=5218"},"modified":"2024-10-10T19:00:42","modified_gmt":"2024-10-10T14:00:42","slug":"change-file-permissions-recursively-chmod-linux","status":"publish","type":"post","link":"https:\/\/arzhost.com\/blogs\/change-file-permissions-recursively-chmod-linux\/","title":{"rendered":"How to Change File Permissions Recursively with chmod in Linux?"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/arzhost.com\/blogs\/change-file-permissions-recursively-chmod-linux\/#Introduction_to_Chmod_in_Linux_and_How_to_Change_File_Permissions\" >Introduction to Chmod in Linux and How to Change File Permissions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/arzhost.com\/blogs\/change-file-permissions-recursively-chmod-linux\/#Verify_File_Permissions\" >Verify File Permissions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/arzhost.com\/blogs\/change-file-permissions-recursively-chmod-linux\/#Modify_Permission_Successively\" >Modify Permission Successively<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/arzhost.com\/blogs\/change-file-permissions-recursively-chmod-linux\/#With_the_find_Command_modify_the_permission\" >With the find Command, modify the permission<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/arzhost.com\/blogs\/change-file-permissions-recursively-chmod-linux\/#Modify_Particular_File_Permissions_Recursively\" >Modify Particular File Permissions Recursively<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/arzhost.com\/blogs\/change-file-permissions-recursively-chmod-linux\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introduction_to_Chmod_in_Linux_and_How_to_Change_File_Permissions\"><\/span>Introduction to Chmod in Linux and How to Change File Permissions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>File permissions must be set up and managed in multi-user systems like How to Change File Permissions Recursively with chmod in <a href=\"https:\/\/www.linux.org\/\" target=\"_blank\" rel=\"noopener\"><strong>Linux<\/strong><\/a>. Linux guarantees that only authorized users have access to the files they are supposed to.<\/p>\n\n\n\n<p>Use the chmod command to modify a file&#8217;s permissions. Also, it enables recursive file permission changes so that you can set numerous files and subdirectories with a single command. <strong>How to Change File Permissions Recursively chmod linux?<\/strong><\/p>\n\n\n\n<p>Want to learn about more guides and get resources like this? Visit our <a href=\"https:\/\/arzhost.com\/blogs\/\"><strong>Blog<\/strong><\/a>!<\/p>\n\n\n\n<p><u>You will discover How to Change File Permissions Recursively with chmod in Linux. and how to use chmod recursively in this article:<\/u><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A terminal window or command line (Ctrl+Alt+F2 or Alt+T)<\/li>\n\n\n\n<li>An individual with sudo rights (optional)<\/li>\n\n\n\n<li>Linux Software<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-cover\" style=\"min-height:273px;aspect-ratio:unset;\"><span aria-hidden=\"true\" class=\"wp-block-cover__background has-background-dim\"><\/span><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"536\" title=\"Advantages of Reseller Hosting Server for Agencies\" class=\"wp-block-cover__image-background wp-image-9807\" alt=\"Advantages of Reseller Hosting Server for Agencies\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-1024x536.webp\" data-object-fit=\"cover\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-1024x536.webp 1024w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-300x157.webp 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-768x402.webp 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-150x79.webp 150w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-450x236.webp 450w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies.webp 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<p class=\"has-text-align-center has-large-font-size\">Powerful Hosting Solutions for Explosive Growth<\/p>\n\n\n\n<p class=\"has-text-align-center\">Build a WordPress website the way you want it. ARZ Host provides even more user-friendly choices for portfolio and website creation.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-50\"><a class=\"wp-block-button__link has-vivid-cyan-blue-to-vivid-purple-gradient-background has-background has-text-align-right wp-element-button\" href=\"https:\/\/arzhost.com\/wordpress-hosting\/\" style=\"border-radius:10px\">                 Managed WordPress Hosting<\/a><\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Verify_File_Permissions\"><\/span><strong>Verify File Permissions<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><u>Use the following command to examine the file permissions in the working directory:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>ls \u2013l<\/code><\/li>\n<\/ul>\n\n\n\n<p><u>All of the files in the directory&#8217;s permissions are listed in the output.<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>For instance, the Example directory has three files with identical permissions: test1.txt, test2.txt, and test3.txt (-rw-rw-r\u2013).<\/code><\/li>\n<\/ul>\n\n\n\n<p><u>According to the file permissions stated above, we know that:<\/u><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The owner has read-only and write-access rights.<\/li>\n\n\n\n<li>The owner&#8217;s group is granted read-and-write access.<\/li>\n\n\n\n<li>There are read-only users.<\/li>\n<\/ol>\n\n\n\n<p><strong>Related Article: <a href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/\">How to Install Apache Tomcat on Linux? Step-by-Step Guide<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Modify_Permission_Successively\"><\/span><strong>Modify Permission Successively<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The standard chmod command is frequently used to modify a single file&#8217;s permissions. But, it&#8217;s possible that you&#8217;ll need to recursively change the permission for each file in a directory.<\/p>\n\n\n\n<p>In certain circumstances, the chmod recursive option (-R or \u2014recursive) sets a directory&#8217;s permissions (and the files it contains). <\/p>\n\n\n\n<p><u>The following syntax is used to recursively change a file&#8217;s permissions:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>[Permission] chmod -R [Directory]<\/code><\/li>\n<\/ul>\n\n\n\n<p><u>As a result, you would type: to give all files in the Example directory the 755 permission.<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>Example: sudo chmod -R 755<\/code><\/li>\n<\/ul>\n\n\n\n<p>The command grants the owner read, write, and execute rights (7) and everyone else reads and executes rights (55). You mind need to find Hidden Files, See our detailed article on <strong><a href=\"https:\/\/arzhost.com\/blogs\/how-to-show-hidden-files-in-linux\/\" data-type=\"link\" data-id=\"https:\/\/arzhost.com\/blogs\/how-to-show-hidden-files-in-linux\/\">Showing Hidden Files in Linux to help you navigate<\/a><\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"With_the_find_Command_modify_the_permission\"><\/span><strong>With the find Command, modify the permission<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The find command can be used to give directories and files different permissions.<\/p>\n\n\n\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/HgMHAbg4TUk\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n\n\n\n<p><u>Using the search command to find files or directories and then passing it on to chmod to set the permission are part of the fundamental syntax:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>using the command sudo locate [directory] -type [d\/f] -exec chmod [privilege];<\/code><\/li>\n<\/ul>\n\n\n\n<p>1: The directory path containing the files and subdirectories you want to configure should be substituted for [directory].<\/p>\n\n\n\n<p>2: Indicate whether the search is for a file or a directory (-type d or -type f).<\/p>\n\n\n\n<p>3: Using the numerical or symbolic modes of the chmod command, set the file&#8217;s [permission].<\/p>\n\n\n\n<p><u>Do not give files the ability to run. The following commands might be run in a typical configuration:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>executing sudo find Example -type d -chmod 755;<\/code><\/li>\n\n\n\n<li><code>execute the command sudo find Example -type f -chmod 644;<\/code><\/li>\n<\/ul>\n\n\n\n<p>The files in this example have 644 (u=rw,go=r) access, whereas the directories have 755 (u=rwx,go=rx) privileges.<\/p>\n\n\n\n<p>By entering the Example directory (cd Example) and displaying the contents, you can confirm that folders and files have various permission levels (ls -l). The result should resemble the following:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Modify_Particular_File_Permissions_Recursively\"><\/span><strong>Modify Particular File Permissions Recursively<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>For modifying the permissions of files of a given type, combine the search command with chmod.<\/p>\n\n\n\n<div class=\"wp-block-cover\" style=\"min-height:273px;aspect-ratio:unset;\"><span aria-hidden=\"true\" class=\"wp-block-cover__background has-background-dim\"><\/span><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"536\" title=\"Advantages of Reseller Hosting Server for Agencies\" class=\"wp-block-cover__image-background wp-image-9807\" alt=\"Advantages of Reseller Hosting Server for Agencies\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-1024x536.webp\" data-object-fit=\"cover\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-1024x536.webp 1024w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-300x157.webp 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-768x402.webp 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-150x79.webp 150w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies-450x236.webp 450w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2024\/04\/Advantages-of-Reseller-Hosting-Server-for-Agencies.webp 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<p class=\"has-text-align-center has-large-font-size\">Powerful Hosting Solutions for Explosive Growth<\/p>\n\n\n\n<p class=\"has-text-align-center\">Build a WordPress website the way you want it. ARZ Host provides even more user-friendly choices for portfolio and website creation.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-16018d1d wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-50\"><a class=\"wp-block-button__link has-vivid-cyan-blue-to-vivid-purple-gradient-background has-background has-text-align-right wp-element-button\" href=\"https:\/\/arzhost.com\/wordpress-hosting\/\" style=\"border-radius:10px\">                 Managed WordPress Hosting<\/a><\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<p><u>The following command syntax can be used to modify a directory&#8217;s permissions for a particular file type:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\"*. [filename extension]\" search [directory] -exec chmod [privilege];<\/code><\/li>\n<\/ul>\n\n\n\n<p><u>For instance, the following command might be used to make all.sh files in the current directory executable:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>exe -name \"*.sh\" -chmod +x;<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You should now be able to use the find command or the chmod -R command to recursively alter the file permissions on your Linux system.<\/p>\n\n\n\n<p>How to Change File Permissions Recursively with chmod in Linux? Alternatively, you can modify the default permissions by using the mask command.<\/p>\n\n\n\n<p>Looking for Reliable Hosting Services where that provide great customer service and help you set up your website or server? Look no further, <a href=\"https:\/\/arzhost.com\/\"><strong>ARZ Host<\/strong><\/a> provides this and more!<\/p>\n\n\n\n<p><strong>Latest Posts:<\/strong><\/p>\n\n\n<ul class=\"wp-block-latest-posts__list wp-block-latest-posts\"><li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/how-to-fix-403-forbidden-error-wordpress\/\">How To Fix 403 Forbidden Error WordPress<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/how-to-get-the-most-out-of-claude-ai\/\">How To Get The Most Out Of Claude Ai<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/bad-gateway-error-502-the-ultimate-guide-to-quick-fixes\/\">Bad Gateway Error (502): The Ultimate Guide to Quick Fixes<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/a-deep-dive-into-todays-best-linux-distros\/\">A Deep Dive Into Today\u2019s Best Linux Distros<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/domain-investor-terms-powerful-strategy\/\">Domain Investor Terms: Expert Insight on Powerful Strategy<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Introduction to Chmod in Linux and How to Change File Permissions File permissions must be set up and managed in multi-user systems like How to Change File Permissions Recursively with chmod in Linux. Linux guarantees that only authorized users have access to the files they are supposed to. Use the chmod command to modify a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5960,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"table_tags":[],"class_list":["post-5218","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/5218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/comments?post=5218"}],"version-history":[{"count":3,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/5218\/revisions"}],"predecessor-version":[{"id":8711,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/5218\/revisions\/8711"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media\/5960"}],"wp:attachment":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media?parent=5218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/categories?post=5218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/tags?post=5218"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/table_tags?post=5218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}