{"id":2077,"date":"2023-04-02T21:32:29","date_gmt":"2023-04-02T21:32:29","guid":{"rendered":"https:\/\/linuxdigest.com\/?p=2077"},"modified":"2023-04-02T21:32:32","modified_gmt":"2023-04-02T21:32:32","slug":"rw-r-r-step-by-step-explanation","status":"publish","type":"post","link":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/","title":{"rendered":"&#8220;-rw-r&#8211;r&#8211;&#8220;: Step by Step Explanation"},"content":{"rendered":"\n<p>When you run the command &#8220;ls -l&#8221; you will be greated by these strings of characters that display the files permissions. At first these arbitrary combinations of dashes, letters, and hyphens may seem daunting to look at. But with a little knowledge, you can easily decipher them, with little more than a glance.<\/p>\n\n\n\n<p>This particular combination, -rw-r&#8211;r&#8211;, is quite common and you will run into it quite often. Let&#8217;s just start with the simple explanation to start with.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What does the Linux permission -rw-r&#8211;r&#8211; mean?<\/h2>\n\n\n\n<p>By deciphering this permission string, we can tell that this is a regular file. The owner of the file has read and write permission, the owning group has only read permission and everyone else has read permission.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The file type field<\/h2>\n\n\n\n<p>The first character in the string is the file type string. In our example the value is represented by a dash. Which tells us it is just a regular file. Most files will have a dash in this file. <\/p>\n\n\n\n<p>But there are other possible values. The &#8216;d&#8217; for directory being probably the most common one. The &#8216;l&#8217; for a symbolic link is also very common. There are several other special file types, but that is a little bit beyond the scope of this tutorial.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The three different groups<\/h2>\n\n\n\n<p>Each file permission string represents three different groups of users. Each group is represented by three characters.<\/p>\n\n\n\n<ul><li><strong>The owner of the file<\/strong>. This is usually the user that created the file. But the owner can be changed afterwards. In this case the owner has the permission string <strong>&#8220;rw-&#8220;<\/strong>. Which means the owner can read the file and write to it. But the dash at the end means that the file is no executable.<\/li><li><strong>The owning group of the file.<\/strong> This is also usually the group the files creator belongs to. But as before it can be changed afterwards. In this example the groups permission is represented by <strong>&#8220;r&#8211;&#8220;<\/strong> which means that members of the group can only read the file.<\/li><li><strong>Others<\/strong>. This is the permission that is applied to every user that is not a member of the owning group and is not the owner of the file. In our example, these users are represented by the <strong>&#8220;r&#8211;&#8220;<\/strong> which means that they can only read the file. They can not write to it and cant run it as an executable file.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Possible values for each group<\/h2>\n\n\n\n<p>As I mentioned before, each group of users is represented by three characters. Each group of characters can typically have these values: <strong>&#8220;rwx&#8221;<\/strong>.<\/p>\n\n\n\n<ul><li>r: meaning read permission. This group can read the file. If this permission is missing, that effectively means that this group has no access to the file.<\/li><li>w: meaning write permission. This group can also write to the file. This is necessary to make any changes to the file. Regular files in a users home directory or configuration files will usually have this permission set.<\/li><li>x: meaning execute permission. A file that can be run as a program or script will need to have this permission set for users that need to run it. Otherwise it will need to be accessed by calling some other program.<\/li><\/ul>\n\n\n\n<p>The last value, &#8220;x&#8221; can be replaced by some other characters in special cases. Such as <a href=\"https:\/\/linuxdigest.com\/howto\/drxrwxrwt-meaning\/\">&#8220;t&#8221; for the sticky bit<\/a> or &#8220;s&#8221; for setuid. But we will leave those edge cases to other tutorials.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Use the chmod command to change permissions<\/h2>\n\n\n\n<p>If your user has write permission to a file, you can change its permissions. To do that you would use the <strong>chmod<\/strong> command. <\/p>\n\n\n\n<p>To change the permission of a file to the permissions in our example, &#8220;-rw-r&#8211;r&#8211;&#8221; we could call chmod in this way:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">chmod u=rw,g=r,o=r name_of_file<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">-rw-r&#8211;r&#8211; in octal<\/h2>\n\n\n\n<p>You can also call chmod with an octal value of the permissions you want to set. This can be much quicker to type, if you know the value you want to set. To set the permission to -rw-r&#8211;r&#8211;:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">chmod 0644 name_of_file<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>So, we&#8217;ve covered the basics of Linux file permissions using the example <strong>&#8220;-rw-r&#8211;r&#8211;.&#8221;<\/strong> We now know who can read the file, who can write to the file and if it is executable.<\/p>\n\n\n\n<p>Knowing how file permissions work is super important if you want to keep your Linux system secure, stable, and user-friendly.<\/p>\n\n\n\n<p>By understanding these concepts, you&#8217;ll be able to manage who can access files and folders, protect important data, make sure your system runs smoothly, and help users work together easily. Plus, this knowledge comes in handy when fixing file access problems or meeting legal rules.<\/p>\n\n\n\n<p>As you keep using Linux, don&#8217;t forget to pay attention to file permissions and update them as needed. With a good understanding of file permissions, you can handle the Linux file system like a pro and get the most out of its awesome features. <\/p>\n\n\n\n<p>Check out some of my other articles below if you want to learn more.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you run the command &#8220;ls -l&#8221; you will be greated by these strings of characters&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2079,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[27],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>&quot;-rw-r-r-&quot;: Step by Step Explanation - Linux Digest<\/title>\n<meta name=\"description\" content=\"-rw-r--r-- is a common permission string you will find when browsing any Linux file system. Join us as we explain what this string means.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"&quot;-rw-r-r-&quot;: Step by Step Explanation - Linux Digest\" \/>\n<meta property=\"og:description\" content=\"-rw-r--r-- is a common permission string you will find when browsing any Linux file system. Join us as we explain what this string means.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Digest\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-02T21:32:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-02T21:32:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linuxdigest.com\/wp-content\/uploads\/2023\/04\/rw-r-r-1-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"819\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"The Linux Digest Guy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"The Linux Digest Guy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/\"},\"author\":{\"name\":\"The Linux Digest Guy\",\"@id\":\"https:\/\/linuxdigest.com\/#\/schema\/person\/29c97230aa94affab929a88c6a10adb2\"},\"headline\":\"&#8220;-rw-r&#8211;r&#8211;&#8220;: Step by Step Explanation\",\"datePublished\":\"2023-04-02T21:32:29+00:00\",\"dateModified\":\"2023-04-02T21:32:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/\"},\"wordCount\":817,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/linuxdigest.com\/#organization\"},\"articleSection\":[\"Command line tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/\",\"url\":\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/\",\"name\":\"\\\"-rw-r-r-\\\": Step by Step Explanation - Linux Digest\",\"isPartOf\":{\"@id\":\"https:\/\/linuxdigest.com\/#website\"},\"datePublished\":\"2023-04-02T21:32:29+00:00\",\"dateModified\":\"2023-04-02T21:32:32+00:00\",\"description\":\"-rw-r--r-- is a common permission string you will find when browsing any Linux file system. Join us as we explain what this string means.\",\"breadcrumb\":{\"@id\":\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/linuxdigest.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"&#8220;-rw-r&#8211;r&#8211;&#8220;: Step by Step Explanation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/linuxdigest.com\/#website\",\"url\":\"https:\/\/linuxdigest.com\/\",\"name\":\"Linux Digest\",\"description\":\"Linux tutorials for everyone\",\"publisher\":{\"@id\":\"https:\/\/linuxdigest.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/linuxdigest.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/linuxdigest.com\/#organization\",\"name\":\"Linux Digest\",\"url\":\"https:\/\/linuxdigest.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/linuxdigest.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/linuxdigest.com\/wp-content\/uploads\/2019\/11\/logo1.png\",\"contentUrl\":\"https:\/\/linuxdigest.com\/wp-content\/uploads\/2019\/11\/logo1.png\",\"width\":1102,\"height\":170,\"caption\":\"Linux Digest\"},\"image\":{\"@id\":\"https:\/\/linuxdigest.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/linuxdigest.com\/#\/schema\/person\/29c97230aa94affab929a88c6a10adb2\",\"name\":\"The Linux Digest Guy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/linuxdigest.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ac6bcf745dec6961360ccf2d2711f26c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ac6bcf745dec6961360ccf2d2711f26c?s=96&d=mm&r=g\",\"caption\":\"The Linux Digest Guy\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\"-rw-r-r-\": Step by Step Explanation - Linux Digest","description":"-rw-r--r-- is a common permission string you will find when browsing any Linux file system. Join us as we explain what this string means.","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:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/","og_locale":"en_US","og_type":"article","og_title":"\"-rw-r-r-\": Step by Step Explanation - Linux Digest","og_description":"-rw-r--r-- is a common permission string you will find when browsing any Linux file system. Join us as we explain what this string means.","og_url":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/","og_site_name":"Linux Digest","article_published_time":"2023-04-02T21:32:29+00:00","article_modified_time":"2023-04-02T21:32:32+00:00","og_image":[{"width":1280,"height":819,"url":"https:\/\/linuxdigest.com\/wp-content\/uploads\/2023\/04\/rw-r-r-1-1.jpg","type":"image\/jpeg"}],"author":"The Linux Digest Guy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"The Linux Digest Guy","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/#article","isPartOf":{"@id":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/"},"author":{"name":"The Linux Digest Guy","@id":"https:\/\/linuxdigest.com\/#\/schema\/person\/29c97230aa94affab929a88c6a10adb2"},"headline":"&#8220;-rw-r&#8211;r&#8211;&#8220;: Step by Step Explanation","datePublished":"2023-04-02T21:32:29+00:00","dateModified":"2023-04-02T21:32:32+00:00","mainEntityOfPage":{"@id":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/"},"wordCount":817,"commentCount":0,"publisher":{"@id":"https:\/\/linuxdigest.com\/#organization"},"articleSection":["Command line tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/","url":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/","name":"\"-rw-r-r-\": Step by Step Explanation - Linux Digest","isPartOf":{"@id":"https:\/\/linuxdigest.com\/#website"},"datePublished":"2023-04-02T21:32:29+00:00","dateModified":"2023-04-02T21:32:32+00:00","description":"-rw-r--r-- is a common permission string you will find when browsing any Linux file system. Join us as we explain what this string means.","breadcrumb":{"@id":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/linuxdigest.com\/howto\/rw-r-r-step-by-step-explanation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/linuxdigest.com\/"},{"@type":"ListItem","position":2,"name":"&#8220;-rw-r&#8211;r&#8211;&#8220;: Step by Step Explanation"}]},{"@type":"WebSite","@id":"https:\/\/linuxdigest.com\/#website","url":"https:\/\/linuxdigest.com\/","name":"Linux Digest","description":"Linux tutorials for everyone","publisher":{"@id":"https:\/\/linuxdigest.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/linuxdigest.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/linuxdigest.com\/#organization","name":"Linux Digest","url":"https:\/\/linuxdigest.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxdigest.com\/#\/schema\/logo\/image\/","url":"https:\/\/linuxdigest.com\/wp-content\/uploads\/2019\/11\/logo1.png","contentUrl":"https:\/\/linuxdigest.com\/wp-content\/uploads\/2019\/11\/logo1.png","width":1102,"height":170,"caption":"Linux Digest"},"image":{"@id":"https:\/\/linuxdigest.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/linuxdigest.com\/#\/schema\/person\/29c97230aa94affab929a88c6a10adb2","name":"The Linux Digest Guy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linuxdigest.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ac6bcf745dec6961360ccf2d2711f26c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ac6bcf745dec6961360ccf2d2711f26c?s=96&d=mm&r=g","caption":"The Linux Digest Guy"}}]}},"_links":{"self":[{"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/posts\/2077"}],"collection":[{"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/comments?post=2077"}],"version-history":[{"count":4,"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/posts\/2077\/revisions"}],"predecessor-version":[{"id":2110,"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/posts\/2077\/revisions\/2110"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/media\/2079"}],"wp:attachment":[{"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/media?parent=2077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/categories?post=2077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxdigest.com\/wp-json\/wp\/v2\/tags?post=2077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}