{"id":201,"date":"2019-10-10T18:37:16","date_gmt":"2019-10-10T18:37:16","guid":{"rendered":"https:\/\/www.peppypage.com\/content\/?p=201"},"modified":"2019-11-23T17:54:21","modified_gmt":"2019-11-23T12:24:21","slug":"guide-to-linux-file-and-folder-permissions","status":"publish","type":"post","link":"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/","title":{"rendered":"Guide to Linux File and Folder Permissions"},"content":{"rendered":"\n<p>File and Folder permissions plays critical security role for any website.  Sometimes website stops working due to incorrect file permissions. This guide explains you how to correct file and folders permissions using command line of linux.<\/p>\n\n\n\n<h2><strong>Using Command Line tool or Terminal to change file permissions<\/strong><\/h2>\n\n\n\n<p>Its very easy to update file permissions using terminal, if you are using Linux based Operating System like Ubuntu, Debian. Press Ctrl + Alt + T to open a terminal, or search for terminal using app launcher.<\/p>\n\n\n\n<p>Now you need root permissions to change file permissions. If you are the only user, enter system password if prompted.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Syntax of chmod for single file\/folder\nsudo chmod [MODE] filename\n\n#Syntax of chmod for whole folder to update permissions for all files inside a folder\nsudo -R [MODE] foldername\n\nExamples: \n#Single file or folder - set to read\/write\/execute for owner, read and execute only to group or others.\nsudo chmod 755 filename\n\n#Loop through folder - set to read\/write for owner, read\/execute for others or group\nsudo chmod 655 foldername<\/code><\/pre>\n\n\n\n<h2>File Permission Modes Explained<\/h2>\n\n\n\n<p><strong>How numbers from 0 to 7 works and what do they mean:<\/strong><\/p>\n\n\n\n<p>We have three main operations allowed in any file system, Which are <strong>READ<\/strong>, <strong>WRITE<\/strong> and <strong>EXECUTE<\/strong>.<br><br>000 &#8211; No permissions, file completely locked<br>111 &#8211; Only File execution allowed, no read and write allowed<br>222 &#8211; Only File write is allowed, no execution and read are allowed<br>333 &#8211; Only File execution and write are allowed, no read allowed<br>444 &#8211; Only Reading of file contents allowed, no execution and writing is allowed &#8211; (This is recommended for making important and sensitive files locked from others).<br>555 &#8211; Only Read and Execution of files is allowed, no write allowed (This is recommended for making important and sensitive files locked from others).<br>644 &#8211; Owner can read, write to a file, but cannot execute it, others can only read it. Most common file permission.<br>655 &#8211; Owner can read and write to a file, but cannot execute it, others can read and execute it. Most common file permission.<br>755 &#8211; Owner can do all read, write and execute operations, others can only read and execute it. Most preferred folder permission.<br>777 &#8211; Every one can read, execute and write to file\/folder, most dangerous and risky permission.<\/p>\n\n\n\n<h2>Preffered Permissions for Files and Folders<\/h2>\n\n\n\n<p>For Files &#8211; Use 644 or 655<br>For Folders &#8211; Use 755<\/p>\n\n\n\n<p>Thats all, keeping it simple, there are many chmod options which were not added as they are not required for most users or server operations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>File and Folder permissions plays critical security role for any website. Sometimes website stops working due to incorrect file permissions. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":155,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,6,2,1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Guide to Linux File and Folder Permissions - Domain, Web Hosting and Cloud Hosting Trends<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Guide to Linux File and Folder Permissions - Domain, Web Hosting and Cloud Hosting Trends\" \/>\n<meta property=\"og:description\" content=\"File and Folder permissions plays critical security role for any website. Sometimes website stops working due to incorrect file permissions. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/\" \/>\n<meta property=\"og:site_name\" content=\"Domain, Web Hosting and Cloud Hosting Trends\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-10T18:37:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-11-23T12:24:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.peppypage.com\/content\/wp-content\/uploads\/2019\/02\/web-3967926_1920.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1114\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"bharathsde\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"bharathsde\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.peppypage.com\/content\/#website\",\"url\":\"https:\/\/www.peppypage.com\/content\/\",\"name\":\"Domain, Web Hosting and Cloud Hosting Trends\",\"description\":\"Learn how to secure your app and website\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.peppypage.com\/content\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/\",\"url\":\"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/\",\"name\":\"Guide to Linux File and Folder Permissions - Domain, Web Hosting and Cloud Hosting Trends\",\"isPartOf\":{\"@id\":\"https:\/\/www.peppypage.com\/content\/#website\"},\"datePublished\":\"2019-10-10T18:37:16+00:00\",\"dateModified\":\"2019-11-23T12:24:21+00:00\",\"author\":{\"@id\":\"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/33a613ea798a2b94d8ec79faa0f76403\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.peppypage.com\/content\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Guide to Linux File and Folder Permissions\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/33a613ea798a2b94d8ec79faa0f76403\",\"name\":\"bharathsde\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6d56691d057a81ea8a03b12c51675abb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6d56691d057a81ea8a03b12c51675abb?s=96&d=mm&r=g\",\"caption\":\"bharathsde\"},\"url\":\"https:\/\/www.peppypage.com\/content\/author\/bharathsde\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Guide to Linux File and Folder Permissions - Domain, Web Hosting and Cloud Hosting Trends","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/","og_locale":"en_US","og_type":"article","og_title":"Guide to Linux File and Folder Permissions - Domain, Web Hosting and Cloud Hosting Trends","og_description":"File and Folder permissions plays critical security role for any website. Sometimes website stops working due to incorrect file permissions. [&hellip;]","og_url":"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/","og_site_name":"Domain, Web Hosting and Cloud Hosting Trends","article_published_time":"2019-10-10T18:37:16+00:00","article_modified_time":"2019-11-23T12:24:21+00:00","og_image":[{"width":1920,"height":1114,"url":"https:\/\/www.peppypage.com\/content\/wp-content\/uploads\/2019\/02\/web-3967926_1920.jpg","type":"image\/jpeg"}],"author":"bharathsde","twitter_card":"summary_large_image","twitter_misc":{"Written by":"bharathsde","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.peppypage.com\/content\/#website","url":"https:\/\/www.peppypage.com\/content\/","name":"Domain, Web Hosting and Cloud Hosting Trends","description":"Learn how to secure your app and website","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.peppypage.com\/content\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/","url":"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/","name":"Guide to Linux File and Folder Permissions - Domain, Web Hosting and Cloud Hosting Trends","isPartOf":{"@id":"https:\/\/www.peppypage.com\/content\/#website"},"datePublished":"2019-10-10T18:37:16+00:00","dateModified":"2019-11-23T12:24:21+00:00","author":{"@id":"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/33a613ea798a2b94d8ec79faa0f76403"},"breadcrumb":{"@id":"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.peppypage.com\/content\/guide-to-linux-file-and-folder-permissions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.peppypage.com\/content\/"},{"@type":"ListItem","position":2,"name":"Guide to Linux File and Folder Permissions"}]},{"@type":"Person","@id":"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/33a613ea798a2b94d8ec79faa0f76403","name":"bharathsde","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6d56691d057a81ea8a03b12c51675abb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6d56691d057a81ea8a03b12c51675abb?s=96&d=mm&r=g","caption":"bharathsde"},"url":"https:\/\/www.peppypage.com\/content\/author\/bharathsde\/"}]}},"_links":{"self":[{"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/posts\/201"}],"collection":[{"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/comments?post=201"}],"version-history":[{"count":3,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/posts\/201\/revisions"}],"predecessor-version":[{"id":219,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/posts\/201\/revisions\/219"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/media\/155"}],"wp:attachment":[{"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/media?parent=201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/categories?post=201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/tags?post=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}