<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mtilson</title>
    <description>The latest articles on DEV Community by mtilson (@mtilson).</description>
    <link>https://dev.to/mtilson</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F376005%2F91d14877-d478-4582-84d7-324d7e62a013.png</url>
      <title>DEV Community: mtilson</title>
      <link>https://dev.to/mtilson</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mtilson"/>
    <language>en</language>
    <item>
      <title>How to deal with Linux file and directory permission</title>
      <dc:creator>mtilson</dc:creator>
      <pubDate>Fri, 31 Jul 2020 20:58:42 +0000</pubDate>
      <link>https://dev.to/mtilson/how-to-deal-with-linux-file-and-directory-permission-36lh</link>
      <guid>https://dev.to/mtilson/how-to-deal-with-linux-file-and-directory-permission-36lh</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9n0THoiZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1s0av7az3ouuk0vefqxd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9n0THoiZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1s0av7az3ouuk0vefqxd.jpg" alt="FlowerPuzzleM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Linux File Permission Cheat Sheet &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Necessary and sufficient knowledge on Linux file and directory permissions&lt;/li&gt;
&lt;li&gt;With practical examples&lt;/li&gt;
&lt;li&gt;Sourced from &lt;a href="https://gist.github.com/mtilson/7403ff3e3c351d21ae245c02f6df4bdc"&gt;GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  User permission triads &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;There are three permission triads (&lt;code&gt;rwx rwx rwx&lt;/code&gt;) corresponding to particular group of users

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;1-st&lt;/code&gt; one (&lt;code&gt;rwx --- ---&lt;/code&gt;) is for &lt;code&gt;owner&lt;/code&gt; user&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;2-nd&lt;/code&gt; one (&lt;code&gt;--- rwx ---&lt;/code&gt;) is for &lt;code&gt;group&lt;/code&gt; users&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;3-rd&lt;/code&gt; one (&lt;code&gt;--- --- rwx&lt;/code&gt;) is for &lt;code&gt;other&lt;/code&gt; users&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Each permission triad (&lt;code&gt;rwx&lt;/code&gt;) corresponds to particular set of operations defined on files and directories

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;r&lt;/code&gt; is for &lt;code&gt;read&lt;/code&gt; operation&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;w&lt;/code&gt; is for &lt;code&gt;write&lt;/code&gt; operation&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;x&lt;/code&gt; is for &lt;code&gt;execute&lt;/code&gt; operation&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  File permissions &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt; file permission

&lt;ul&gt;
&lt;li&gt;Allows the corresponding user (&lt;code&gt;owner&lt;/code&gt;, &lt;code&gt;group&lt;/code&gt;, &lt;code&gt;other&lt;/code&gt;) to read the file&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;write&lt;/code&gt; file permission

&lt;ul&gt;
&lt;li&gt;Allows the corresponding user to modify (create, move, rename, change attributes, delete) the file&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;execute&lt;/code&gt; file permission

&lt;ul&gt;
&lt;li&gt;Allows the corresponding user to execute the file&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;All the above permissions have effect only if &lt;code&gt;execute&lt;/code&gt; permission for the corresponding user is set on the directory and all its parent directories

&lt;ul&gt;
&lt;li&gt;See Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on file permissions
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  File permission examples &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Effects of &lt;code&gt;read&lt;/code&gt; file permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file
&lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt; 1 user1 user1 5 Jul 26 21:59 file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;file
&lt;span class="nb"&gt;test

&lt;/span&gt;user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-r file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file
&lt;span class="nt"&gt;--w--w----&lt;/span&gt; 1 user1 user1 5 Jul 26 21:59 file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;file
&lt;span class="nb"&gt;cat&lt;/span&gt;: file: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;write&lt;/code&gt; file permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file
&lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt; 1 user1 user1 5 Jul 26 22:00 file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-w file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file
&lt;span class="nt"&gt;-r--r--r--&lt;/span&gt; 1 user1 user1 5 Jul 26 22:00 file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
&lt;span class="nt"&gt;-bash&lt;/span&gt;: file: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;execute&lt;/code&gt; file permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"#/usr/bin/env bash"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"date"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file
&lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt; 1 user1 user1 24 Jul 26 22:02 file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;./file
Sun 26 Jul 2020 10:02:35 PM UTC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-x file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file
&lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt; 1 user1 user1 24 Jul 26 22:02 file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;./file
&lt;span class="nt"&gt;-bash&lt;/span&gt;: ./file: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on file permissions &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;code&gt;read&lt;/code&gt; file permission
&lt;/h5&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ..
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;find ./tmp/ &lt;span class="nt"&gt;-ls&lt;/span&gt;
   259893      4 drwxrwxr-x   2 user1    user1        4096 Jul 26 22:03 ./tmp/
   259894      4 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           5 Jul 26 22:03 ./tmp/file

user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ./tmp/file
&lt;span class="nb"&gt;test

&lt;/span&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-x tmp/
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;find ./tmp/ &lt;span class="nt"&gt;-ls&lt;/span&gt;
   259893      4 drw-rw-r--   2 user1    user1        4096 Jul 26 22:03 ./tmp/
find: ‘./tmp/file’: Permission denied

user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ./tmp/file
&lt;span class="nb"&gt;cat&lt;/span&gt;: ./tmp/file: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;code&gt;write&lt;/code&gt; file permission
&lt;/h5&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ..
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; tmp/file
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;find ./tmp/ &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwxr-x   2 user1    user1        4096 Jul 26 22:53 ./tmp/
   258941      4 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           5 Jul 26 22:53 ./tmp/file

user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-x tmp/
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;find ./tmp/ &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drw-rw-r--   2 user1    user1        4096 Jul 26 22:53 ./tmp/
find: ‘./tmp/file’: Permission denied

user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; tmp/file
&lt;span class="nt"&gt;-bash&lt;/span&gt;: tmp/file: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;code&gt;execute&lt;/code&gt; file permission
&lt;/h5&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"#/usr/bin/env bash"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"date"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ..
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;find ./tmp/ &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwxr-x   2 user1    user1        4096 Jul 26 23:01 ./tmp/
   258941      4 &lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt;   1 user1    user1          24 Jul 26 23:01 ./tmp/file

user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;./tmp/file
Sun 26 Jul 2020 11:01:41 PM UTC

user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-x tmp/
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;find ./tmp/ &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drw-rw-r--   2 user1    user1        4096 Jul 26 23:01 ./tmp/
find: ‘./tmp/file’: Permission denied

user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;./tmp/file
&lt;span class="nt"&gt;-bash&lt;/span&gt;: ./tmp/file: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Directory permissions &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt; directory permission

&lt;ul&gt;
&lt;li&gt;Allows the corresponding user (&lt;code&gt;owner&lt;/code&gt;, &lt;code&gt;group&lt;/code&gt;, &lt;code&gt;other&lt;/code&gt;) to display directory’s files and subdirectories&lt;/li&gt;
&lt;li&gt;Has effect only on the files and subdirectories which are directly beneath the subject directory

&lt;ul&gt;
&lt;li&gt;This means, for example, that if a directory has no &lt;code&gt;read&lt;/code&gt; permission, but its subdirectory does have &lt;code&gt;read&lt;/code&gt; permission, than it is possible to display the subdirectory’s files and subdirectories&lt;/li&gt;
&lt;li&gt;See Effects of &lt;code&gt;read&lt;/code&gt; directory permission propagate only on files and subdirectories which are directly beneath the subject directory
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Has effect only if &lt;code&gt;execute&lt;/code&gt; permission for the corresponding user is also set on the directory and all its parent directories

&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;execute&lt;/code&gt; permission is not set on the directory it is only possible to see the names of files and subdirectories directly beneath the subject directory, any details about these files and subdirectories and their content are not available&lt;/li&gt;
&lt;li&gt;See Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on &lt;code&gt;read&lt;/code&gt; directory permission
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;write&lt;/code&gt; directory permission

&lt;ul&gt;
&lt;li&gt;Allows the corresponding user to modify (create, move, rename, change attributes, delete) files and subdirectories within the directory&lt;/li&gt;
&lt;li&gt;Has effect only on the files and subdirectories which are directly beneath the subject directory

&lt;ul&gt;
&lt;li&gt;This means, for example, that if a directory has &lt;code&gt;write&lt;/code&gt; permission, but its subdirectory doesn't have &lt;code&gt;write&lt;/code&gt; permission and it is not empty, than it is not possible to delete or move the subdirectory, as in this case there is no &lt;code&gt;write&lt;/code&gt; permission on file within the subdirectory&lt;/li&gt;
&lt;li&gt;See Effects of &lt;code&gt;write&lt;/code&gt; directory permission propagate only on files and subdirectories which are directly beneath the subject directory
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Has effect on files and subdirectories of the subject directory independent of the permissions of these files and subdirectories

&lt;ul&gt;
&lt;li&gt;The directory &lt;code&gt;write&lt;/code&gt; permission gives the corresponding user the permission to modify files and subdirectories beneath the subject directory &lt;em&gt;independent on the permissions of these files and subdirectories&lt;/em&gt;, meaning that even if those files and subdirectories don't have &lt;code&gt;write&lt;/code&gt; permissions, they can be modified&lt;/li&gt;
&lt;li&gt;See Effects of &lt;code&gt;write&lt;/code&gt; directory permission do not depend on permissions of files and subdirectories beneath the subject directory
&lt;/li&gt;
&lt;li&gt;This behavior can be changed with help of &lt;code&gt;Sticky bit&lt;/code&gt;, see the section &lt;strong&gt;Additional flags: &lt;code&gt;SUID&lt;/code&gt;, &lt;code&gt;SGID&lt;/code&gt;, &lt;code&gt;Sticky bit&lt;/code&gt;&lt;/strong&gt; below&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Has effect only if &lt;code&gt;execute&lt;/code&gt; permission for the corresponding user is also set on the directory and all its parent directories

&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;execute&lt;/code&gt; permission is not set on the directory, directory &lt;code&gt;write&lt;/code&gt; permission has no effect at all, and it is not depend on directory &lt;code&gt;read&lt;/code&gt; permission&lt;/li&gt;
&lt;li&gt;See Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on &lt;code&gt;write&lt;/code&gt; directory permission
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;execute&lt;/code&gt; directory permission

&lt;ul&gt;
&lt;li&gt;Allows the corresponding user to change their current working directory to this directory (via the &lt;code&gt;cd&lt;/code&gt; command)&lt;/li&gt;
&lt;li&gt;Has effect as long as this &lt;code&gt;execute&lt;/code&gt; permission is set on all parent directories as well

&lt;ul&gt;
&lt;li&gt;See Effects of &lt;code&gt;execute&lt;/code&gt; directory permission propagate on all subdirectories of the subject directory
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Affects &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; directory permissions

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rwx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full access&lt;/strong&gt; to a directory is provided by combining &lt;code&gt;execute&lt;/code&gt; permission with &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; permissions&lt;/li&gt;
&lt;li&gt;&lt;code&gt;r-x&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read only access&lt;/strong&gt; to a directory is provided by combining &lt;code&gt;execute&lt;/code&gt; permission with &lt;code&gt;read&lt;/code&gt; permission

&lt;ul&gt;
&lt;li&gt;See Effects of &lt;code&gt;write&lt;/code&gt; directory permission
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-wx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Combining &lt;code&gt;execute&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; directory permissions (without &lt;code&gt;read&lt;/code&gt; permission) leads to &lt;em&gt;&lt;strong&gt;weird access&lt;/strong&gt;&lt;/em&gt; mode, where &lt;strong&gt;full access&lt;/strong&gt; to the directory is enabled, but standard way of displaying names of files and directories is not possible

&lt;ul&gt;
&lt;li&gt;See Combining &lt;code&gt;execute&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; directory permissions with unset &lt;code&gt;read&lt;/code&gt; directory permission
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rw-&lt;/code&gt;, &lt;code&gt;r--&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Disabling &lt;code&gt;execute&lt;/code&gt; permission for a directory with set &lt;code&gt;read&lt;/code&gt; permission leads to &lt;em&gt;&lt;strong&gt;weird access&lt;/strong&gt;&lt;/em&gt; mode, where only reading names of files and directories directly beneath the subject directory is possible

&lt;ul&gt;
&lt;li&gt;See Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on &lt;code&gt;read&lt;/code&gt; directory permission
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-w-&lt;/code&gt;, &lt;code&gt;---&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Disabling &lt;code&gt;execute&lt;/code&gt; permission for a directory with unset &lt;code&gt;read&lt;/code&gt; permission is the same as providing &lt;strong&gt;no access&lt;/strong&gt; to the directory

&lt;ul&gt;
&lt;li&gt;See Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on &lt;code&gt;read&lt;/code&gt; directory permission and Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on &lt;code&gt;write&lt;/code&gt; directory permission
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--x&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Setting &lt;code&gt;execute&lt;/code&gt; permission on a directory where &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; permissions are unset leads to &lt;em&gt;&lt;strong&gt;weird access&lt;/strong&gt;&lt;/em&gt; mode, where it is possible to change current working directory to subdirectories of the subject directory (if the names of those subdirectories are known preliminarily) and to do any operations except ones related to reading or modifying directory structures themselves (reading names from the directory; creating, moving, renaming, deleting files or subdirectories)

&lt;ul&gt;
&lt;li&gt;See Effects of setting only &lt;code&gt;execute&lt;/code&gt; directory permission
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Directory permissions short summary&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;permission triad&lt;/th&gt;
&lt;th&gt;access mode&lt;/th&gt;
&lt;th&gt;comments&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;---&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;no access&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;r--&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;weird mode&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;only reading file and subdirectory names is possible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-w-&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;no access&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;the same as &lt;code&gt;---&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--x&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;weird mode&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;only changing to subdirectories are possible if their names are known&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rw-&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;weird mode&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;the same as &lt;code&gt;r--&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;r-x&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;read only&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-wx&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;weird mode&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;any operations on files and subdirectories are possible if their names are known&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rwx&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;full&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Directory permission examples &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Effects of &lt;code&gt;read&lt;/code&gt; directory permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/dirB/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258126      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 20:59 &lt;span class="nb"&gt;.&lt;/span&gt;
   258308      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 20:59 ./dirA
   258915      4 drwxrwxr-x   2 user1    user1        4096 Jul 24 20:59 ./dirA/dirB
   258916      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 24 20:59 ./dirA/dirB/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-r ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258126      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 20:59 &lt;span class="nb"&gt;.&lt;/span&gt;
   258308      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 20:59 ./dirA
   258915      4 d-wx-wx--x   2 user1    user1        4096 Jul 24 20:59 ./dirA/dirB
find: ‘./dirA/dirB’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+r ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258126      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 21:02 &lt;span class="nb"&gt;.&lt;/span&gt;
   258308      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 21:02 ./dirA
   258915      4 drwxrwxr-x   2 user1    user1        4096 Jul 24 21:02 ./dirA/dirB
   258916      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 24 21:02 ./dirA/dirB/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-r ./dirA
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258126      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 21:02 &lt;span class="nb"&gt;.&lt;/span&gt;
   258308      4 d-wx-wx--x   3 user1    user1        4096 Jul 24 21:02 ./dirA
find: ‘./dirA’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+r ./dirA
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258126      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 21:02 &lt;span class="nb"&gt;.&lt;/span&gt;
   258308      4 drwxrwxr-x   3 user1    user1        4096 Jul 24 21:02 ./dirA
   258915      4 drwxrwxr-x   2 user1    user1        4096 Jul 24 21:02 ./dirA/dirB
   258916      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 24 21:02 ./dirA/dirB/file
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;read&lt;/code&gt; directory permission propagate only on files and subdirectories which are directly beneath the subject directory &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Directory &lt;code&gt;read&lt;/code&gt; permission doesn't propagate to the directory hieracy further than the directory directly beneath the subject directory
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; dirA/dirB/dirC/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:50 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:50 ./dirA
   258920      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:50 ./dirA/dirB
   258924      4 drwxrwxr-x   2 user1    user1        4096 Jul 31 11:50 ./dirA/dirB/dirC
   258942      4 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           5 Jul 31 11:50 ./dirA/dirB/dirC/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-r ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:50 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:50 ./dirA
   258920      4 d-wx-wx--x   3 user1    user1        4096 Jul 31 11:50 ./dirA/dirB
find: ‘./dirA/dirB’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; ./dirA/dirB
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot open directory &lt;span class="s1"&gt;'./dirA/dirB'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; ./dirA/dirB/dirC
total 12
drwxrwxr-x 2 user1 user1 4096 Jul 31 11:50 &lt;span class="nb"&gt;.&lt;/span&gt;
d-wx-wx--x 3 user1 user1 4096 Jul 31 11:50 ..
&lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt; 1 user1 user1    5 Jul 31 11:50 file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ./dirA/dirB/dirC
user1@ubuntu20lts:~/tmp/dirA/dirB/dirC&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt;
total 12
drwxrwxr-x 2 user1 user1 4096 Jul 31 11:50 &lt;span class="nb"&gt;.&lt;/span&gt;
d-wx-wx--x 3 user1 user1 4096 Jul 31 11:50 ..
&lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt; 1 user1 user1    5 Jul 31 11:50 file

user1@ubuntu20lts:~/tmp/dirA/dirB/dirC&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;file
&lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;write&lt;/code&gt; directory permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;We cannot create, move, rename, and delete files and subdirectories in the directory which have no &lt;code&gt;write&lt;/code&gt; directory permissions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:35 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:35 ./dirA
   258973      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:36 ./dirA/dirB
   259894      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 11:36 ./dirA/dirB/file
   259889      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 11:35 ./dirA/dirB/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-w ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:35 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:35 ./dirA
   258973      4 dr-xr-xr-x   3 user1    user1        4096 Jul 27 11:36 ./dirA/dirB
   259894      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 11:36 ./dirA/dirB/file
   259889      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 11:35 ./dirA/dirB/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./dirA/dirB
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt;: Permission denied
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./dirA/dirB/dirC
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/file ./dirA/dirB/file1
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot move &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt; to &lt;span class="s1"&gt;'./dirA/dirB/file1'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/dirC ./dirA/dirB/dirD
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot move &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt; to &lt;span class="s1"&gt;'./dirA/dirB/dirD'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch&lt;/span&gt; ./dirA/dirB/file1
&lt;span class="nb"&gt;touch&lt;/span&gt;: cannot &lt;span class="nb"&gt;touch&lt;/span&gt; &lt;span class="s1"&gt;'./dirA/dirB/file1'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; ./dirA/dirB/dirD
&lt;span class="nb"&gt;mkdir&lt;/span&gt;: cannot create directory ‘./dirA/dirB/dirD’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+w ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:35 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:35 ./dirA
   258973      4 drwxrwxrwx   3 user1    user1        4096 Jul 27 11:36 ./dirA/dirB
   259894      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 11:36 ./dirA/dirB/file
   259889      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 11:35 ./dirA/dirB/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:35 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 11:37 ./dirA
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;But we can write to files (if file's permission allows this) and change attributes of files and subdirectories in the directory which has no &lt;code&gt;write&lt;/code&gt; directory permissions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:40 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:40 ./dirA
   258973      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:40 ./dirA/dirB
   259894      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 11:40 ./dirA/dirB/file
   259889      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 11:40 ./dirA/dirB/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-w ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:40 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:40 ./dirA
   258973      4 dr-xr-xr-x   3 user1    user1        4096 Jul 27 11:40 ./dirA/dirB
   259894      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 11:40 ./dirA/dirB/file
   259889      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 11:40 ./dirA/dirB/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-rw ./dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-rwx ./dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:40 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:40 ./dirA
   258973      4 dr-xr-xr-x   3 user1    user1        4096 Jul 27 11:40 ./dirA/dirB
   259894      0 &lt;span class="nt"&gt;----------&lt;/span&gt;   1 user1    user1           0 Jul 27 11:40 ./dirA/dirB/file
   259889      4 d---------   2 user1    user1        4096 Jul 27 11:40 ./dirA/dirB/dirC
find: ‘./dirA/dirB/dirC’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+rw ./dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"test"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ./dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;write&lt;/code&gt; directory permission propagate only on files and subdirectories which are directly beneath the subject directory &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Directory &lt;code&gt;write&lt;/code&gt; permission doesn't propagate to the directory hieracy further than the directory directly beneath the subject directory
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/dirB/dirC/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-w dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 13:13 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 13:13 ./dirA
   258973      4 dr-xr-xr-x   3 user1    user1        4096 Jul 27 13:13 ./dirA/dirB
   259889      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 13:13 ./dirA/dirB/dirC
   259894      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 13:13 ./dirA/dirB/dirC/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/dirC/file ./dirA/dirB/dirC/file1
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;o+w ./dirA/dirB/dirC/file1
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/dirC/file1 ./
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;file1 ./dirA/dirB/dirC/file2
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch&lt;/span&gt; ./dirA/dirB/dirC/file3
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; ./dirA/dirB/dirC/file3
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 13:14 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 13:13 ./dirA
   258973      4 dr-xr-xr-x   3 user1    user1        4096 Jul 27 13:13 ./dirA/dirB
   259889      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 13:14 ./dirA/dirB/dirC
   259894      0 &lt;span class="nt"&gt;-rw-rw-rw-&lt;/span&gt;   1 user1    user1           0 Jul 27 13:13 ./dirA/dirB/dirC/file2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;write&lt;/code&gt; directory permission do not depend on permissions of files and subdirectories beneath the subject directory &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Within the directory with &lt;code&gt;write&lt;/code&gt; permission we can modify (rename, change attributes, delete) files and subdirectories which have no &lt;code&gt;write&lt;/code&gt; permission
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:05 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:05 ./dirA
   259889      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 11:05 ./dirA/file
   258973      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 11:05 ./dirA/dirB

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-w dirA/file dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:05 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:05 ./dirA
   259889      0 &lt;span class="nt"&gt;-r--r--r--&lt;/span&gt;   1 user1    user1           0 Jul 27 11:05 ./dirA/file
   258973      4 dr-xr-xr-x   2 user1    user1        4096 Jul 27 11:05 ./dirA/dirB

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;dirA/file dirA/file1
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;dirA/dirB dirA/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-r ./dirA/file1
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-rx ./dirA/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:05 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:06 ./dirA
   259889      0 &lt;span class="nt"&gt;----------&lt;/span&gt;   1 user1    user1           0 Jul 27 11:05 ./dirA/file1
   258973      4 d---------   2 user1    user1        4096 Jul 27 11:05 ./dirA/dirC
find: ‘./dirA/dirC’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; dirA/file1 dirA/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 11:05 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 11:06 ./dirA
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;But within the directory with &lt;code&gt;write&lt;/code&gt; permission we can only move files but not subdirectories which have no &lt;code&gt;write&lt;/code&gt; permission, ⁉️ &lt;strong&gt;which looks strange&lt;/strong&gt; ⁉️
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:34 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:34 ./dirA
   259889      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 12:34 ./dirA/file
   258973      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 12:34 ./dirA/dirB

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-w dirA/file dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:34 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:34 ./dirA
   259889      0 &lt;span class="nt"&gt;-r--r--r--&lt;/span&gt;   1 user1    user1           0 Jul 27 12:34 ./dirA/file
   258973      4 dr-xr-xr-x   2 user1    user1        4096 Jul 27 12:34 ./dirA/dirB

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/file ./
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB ./
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot move &lt;span class="s1"&gt;'./dirA/dirB'&lt;/span&gt; to &lt;span class="s1"&gt;'./dirB'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:35 &lt;span class="nb"&gt;.&lt;/span&gt;
   259889      0 &lt;span class="nt"&gt;-r--r--r--&lt;/span&gt;   1 user1    user1           0 Jul 27 12:34 ./file
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:35 ./dirA
   258973      4 dr-xr-xr-x   2 user1    user1        4096 Jul 27 12:34 ./dirA/dirB

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+w dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB ./
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   4 user1    user1        4096 Jul 27 12:36 &lt;span class="nb"&gt;.&lt;/span&gt;
   259889      0 &lt;span class="nt"&gt;-r--r--r--&lt;/span&gt;   1 user1    user1           0 Jul 27 12:34 ./file
   258943      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 12:36 ./dirA
   258973      4 drwxrwxrwx   2 user1    user1        4096 Jul 27 12:34 ./dirB
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Also within the directory with &lt;code&gt;write&lt;/code&gt; permission we cannot delete subdirectories which have no &lt;code&gt;write&lt;/code&gt; permission and are not empty, but can rename them and change their attributes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-w dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:51 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:51 ./dirA
   258973      4 dr-xr-xr-x   2 user1    user1        4096 Jul 27 12:51 ./dirA/dirB
   259889      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 12:51 ./dirA/dirB/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; dirA/dirB
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'dirA/dirB/file'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; dirA/dirB/file
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'dirA/dirB/file'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;dirA/dirB dirA/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;o+t ./dirA/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:51 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:52 ./dirA
   258973      4 dr-xr-xr-t   2 user1    user1        4096 Jul 27 12:51 ./dirA/dirC
   259889      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 27 12:51 ./dirA/dirC/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+w dirA/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; dirA/dirC/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-w dirA/dirC/
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:51 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:52 ./dirA
   258973      4 dr-xr-xr-t   2 user1    user1        4096 Jul 27 12:55 ./dirA/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; dirA/dirC/
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 27 12:51 &lt;span class="nb"&gt;.&lt;/span&gt;
   258943      4 drwxrwxr-x   2 user1    user1        4096 Jul 27 12:55 ./dirA
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;execute&lt;/code&gt; directory permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:19 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:19 ./dirA
   258921      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:19 ./dirA/dirB
   258924      4 drwxrwxr-x   2 user1    user1        4096 Jul 28 15:19 ./dirA/dirB/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ./dirA/dirB
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;dirC/
user1@ubuntu20lts:~/tmp/dirA/dirB/dirC&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-x ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:19 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:19 ./dirA
   258921      4 drw-rw-r--   3 user1    user1        4096 Jul 28 15:19 ./dirA/dirB
find: ‘./dirA/dirB/dirC’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ./dirA/dirB
&lt;span class="nt"&gt;-bash&lt;/span&gt;: &lt;span class="nb"&gt;cd&lt;/span&gt;: ./dirA/dirB: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ./dirA/dirB/dirC
&lt;span class="nt"&gt;-bash&lt;/span&gt;: &lt;span class="nb"&gt;cd&lt;/span&gt;: ./dirA/dirB/dirC: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;execute&lt;/code&gt; directory permission propagate on all subdirectories of the subject directory &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 12:34 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 12:34 ./dirA
   258920      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 12:34 ./dirA/dirB
   258924      4 drwxrwxr-x   2 user1    user1        4096 Jul 31 12:34 ./dirA/dirB/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;dirA/dirB
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;dirC/
user1@ubuntu20lts:~/tmp/dirA/dirB/dirC&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-x dirA/dirB

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; dirA/dirB
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'dirA/dirB/.'&lt;/span&gt;: Permission denied
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'dirA/dirB/dirC'&lt;/span&gt;: Permission denied
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'dirA/dirB/..'&lt;/span&gt;: Permission denied
total 0
d????????? ? ? ? ?            ? &lt;span class="nb"&gt;.&lt;/span&gt;
d????????? ? ? ? ?            ? ..
d????????? ? ? ? ?            ? dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; dirA/dirB/dirC
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'dirA/dirB/dirC'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;dirA/dirB
&lt;span class="nt"&gt;-bash&lt;/span&gt;: &lt;span class="nb"&gt;cd&lt;/span&gt;: dirA/dirB: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;dirA/dirB/dirC
&lt;span class="nt"&gt;-bash&lt;/span&gt;: &lt;span class="nb"&gt;cd&lt;/span&gt;: dirA/dirB/dirC: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on &lt;code&gt;read&lt;/code&gt; directory permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/dirB/file dirA/dirB/dirC/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:59 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:59 ./dirA
   258921      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 16:00 ./dirA/dirB
   258942      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 28 16:00 ./dirA/dirB/file
   258924      4 drwxrwxr-x   2 user1    user1        4096 Jul 28 16:00 ./dirA/dirB/dirC
   258943      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 28 16:00 ./dirA/dirB/dirC/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-x ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:59 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 28 15:59 ./dirA
   258921      4 drw-rw-r--   3 user1    user1        4096 Jul 28 16:00 ./dirA/dirB
find: ‘./dirA/dirB/file’: Permission denied
find: ‘./dirA/dirB/dirC’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; ./dirA/dirB
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt;: Permission denied
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt;: Permission denied
total 0
d????????? ? ? ? ?            ? dirC
-????????? ? ? ? ?            ? file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; ./dirA/dirB/dirC
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nb"&gt;cat&lt;/span&gt;: ./dirA/dirB/file: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of unset &lt;code&gt;execute&lt;/code&gt; directory permission on &lt;code&gt;write&lt;/code&gt; directory permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/dirB/file dirA/dirB/dirC/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 06:11 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 06:11 ./dirA
   258920      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 06:11 ./dirA/dirB
   258922      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 31 06:11 ./dirA/dirB/file
   258921      4 drwxrwxr-x   2 user1    user1        4096 Jul 31 06:11 ./dirA/dirB/dirC
   258924      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 31 06:11 ./dirA/dirB/dirC/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-x ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 06:11 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 06:11 ./dirA
   258920      4 drw-rw-r--   3 user1    user1        4096 Jul 31 06:11 ./dirA/dirB
find: ‘./dirA/dirB/file’: Permission denied
find: ‘./dirA/dirB/dirC’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./dirA/dirB/dirC
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch&lt;/span&gt; ./dirA/dirB/file1
&lt;span class="nb"&gt;touch&lt;/span&gt;: cannot &lt;span class="nb"&gt;touch&lt;/span&gt; &lt;span class="s1"&gt;'./dirA/dirB/file1'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; ./dirA/dirB/dirD
&lt;span class="nb"&gt;mkdir&lt;/span&gt;: cannot create directory ‘./dirA/dirB/dirD’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/file ./dirA/dirB/file1
&lt;span class="nb"&gt;mv&lt;/span&gt;: failed to access &lt;span class="s1"&gt;'./dirA/dirB/file1'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/dirC ./dirA/dirB/dirD
&lt;span class="nb"&gt;mv&lt;/span&gt;: failed to access &lt;span class="s1"&gt;'./dirA/dirB/dirD'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/file ./
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot &lt;span class="nb"&gt;stat&lt;/span&gt; &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/dirC ./
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot &lt;span class="nb"&gt;stat&lt;/span&gt; &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x ./dirA/dirB/file
&lt;span class="nb"&gt;chmod&lt;/span&gt;: cannot access &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt;: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Combining &lt;code&gt;execute&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; directory permissions with unset &lt;code&gt;read&lt;/code&gt; directory permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;dirA/dirB/dirC/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:39 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:39 ./dirA
   258920      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:39 ./dirA/dirB
   258943      4 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           5 Jul 31 11:39 ./dirA/dirB/file
   258924      4 drwxrwxr-x   2 user1    user1        4096 Jul 31 11:39 ./dirA/dirB/dirC
   258942      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           0 Jul 31 11:39 ./dirA/dirB/dirC/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-r ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:39 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 11:39 ./dirA
   258920      4 d-wx-wx--x   3 user1    user1        4096 Jul 31 11:39 ./dirA/dirB
find: ‘./dirA/dirB’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt; 1 user1 user1 5 Jul 31 11:39 ./dirA/dirB/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nb"&gt;test

&lt;/span&gt;user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; ./dirA/dirB/dirC
total 8
drwxrwxr-x 2 user1 user1 4096 Jul 31 11:39 &lt;span class="nb"&gt;.&lt;/span&gt;
d-wx-wx--x 3 user1 user1 4096 Jul 31 11:39 ..
&lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt; 1 user1 user1    0 Jul 31 11:39 file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ./dirA/dirB
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258920      4 d-wx-wx--x   3 user1    user1        4096 Jul 31 11:39 &lt;span class="nb"&gt;.&lt;/span&gt;
find: ‘.’: Permission denied

user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot open directory &lt;span class="s1"&gt;'.'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;dirD
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;dirD dirE
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; dirE

user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;file1
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;file1 file2
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; file2

user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;dirC ../

user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x file
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; file
&lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt; 1 user1 user1 5 Jul 31 11:39 file
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of setting only &lt;code&gt;execute&lt;/code&gt; directory permission &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; dirA/dirB/dirC
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo test&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 13:48 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 13:48 ./dirA
   258920      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 13:48 ./dirA/dirB
   258942      4 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user1    user1           5 Jul 31 13:48 ./dirA/dirB/file
   258924      4 drwxrwxr-x   2 user1    user1        4096 Jul 31 13:48 ./dirA/dirB/dirC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a-wr ./dirA/dirB
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258312      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 13:48 &lt;span class="nb"&gt;.&lt;/span&gt;
   258916      4 drwxrwxr-x   3 user1    user1        4096 Jul 31 13:48 ./dirA
   258920      4 d--x--x--x   3 user1    user1        4096 Jul 31 13:48 ./dirA/dirB
find: ‘./dirA/dirB’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; ./dirA/dirB
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot open directory &lt;span class="s1"&gt;'./dirA/dirB'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt; 1 user1 user1 5 Jul 31 13:48 ./dirA/dirB/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; ./dirA/dirB/dirC
total 0

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;dirA/dirB/
user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot open directory &lt;span class="s1"&gt;'.'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258920      4 d--x--x--x   3 user1    user1        4096 Jul 31 13:48 &lt;span class="nb"&gt;.&lt;/span&gt;
find: ‘.’: Permission denied

user1@ubuntu20lts:~/tmp/dirA/dirB&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;dirC
user1@ubuntu20lts:~/tmp/dirA/dirB/dirC&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/tmp

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nb"&gt;test

&lt;/span&gt;user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"date"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ./dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x ./dirA/dirB/file
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt; 1 user1 user1 5 Jul 31 13:49 ./dirA/dirB/file

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;./dirA/dirB/file
Fri 31 Jul 2020 01:49:55 PM UTC

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch&lt;/span&gt; ./dirA/dirB/file1
&lt;span class="nb"&gt;touch&lt;/span&gt;: cannot &lt;span class="nb"&gt;touch&lt;/span&gt; &lt;span class="s1"&gt;'./dirA/dirB/file1'&lt;/span&gt;: Permission denied
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; ./dirA/dirB/dirD
&lt;span class="nb"&gt;mkdir&lt;/span&gt;: cannot create directory ‘./dirA/dirB/dirD’: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./dirA/dirB/file
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt;: Permission denied
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./dirA/dirB/dirC
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/file ./dirA/dirB/file1
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot move &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt; to &lt;span class="s1"&gt;'./dirA/dirB/file1'&lt;/span&gt;: Permission denied
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/dirC ./dirA/dirB/dirD
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot move &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt; to &lt;span class="s1"&gt;'./dirA/dirB/dirD'&lt;/span&gt;: Permission denied

user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/file ./
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot move &lt;span class="s1"&gt;'./dirA/dirB/file'&lt;/span&gt; to &lt;span class="s1"&gt;'./file'&lt;/span&gt;: Permission denied
user1@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv&lt;/span&gt; ./dirA/dirB/dirC ./
&lt;span class="nb"&gt;mv&lt;/span&gt;: cannot move &lt;span class="s1"&gt;'./dirA/dirB/dirC'&lt;/span&gt; to &lt;span class="s1"&gt;'./dirC'&lt;/span&gt;: Permission denied
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Additional flags: &lt;code&gt;SUID&lt;/code&gt;, &lt;code&gt;SGID&lt;/code&gt;, &lt;code&gt;Sticky bit&lt;/code&gt; &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;SUID&lt;/code&gt; (&lt;strong&gt;Set User ID&lt;/strong&gt;) flag — works only on files

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;On fies&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;A process executing a file keeps its effective &lt;code&gt;UID&lt;/code&gt; (&lt;strong&gt;User ID&lt;/strong&gt;) the same as &lt;code&gt;UID&lt;/code&gt; of the user running the executable&lt;/li&gt;
&lt;li&gt;If the executable file has the &lt;code&gt;SUID&lt;/code&gt; flag set, the process sets its effective &lt;code&gt;UID&lt;/code&gt; equals to the file's &lt;code&gt;owner&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Due to security reason &lt;code&gt;SUID&lt;/code&gt; flag only works on Linux ELF executables, meaning it does nothing on a &lt;code&gt;Bash&lt;/code&gt; or &lt;code&gt;Python&lt;/code&gt; scripts files&lt;/li&gt;
&lt;li&gt;Examples of well-known Linux system executables with &lt;code&gt;SUID&lt;/code&gt; flag set&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/usr/bin/passwd&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SUID&lt;/code&gt; flag set because the passwords are stored in the &lt;code&gt;/etc/shadow&lt;/code&gt; file, which has no permission on &lt;code&gt;group&lt;/code&gt; or &lt;code&gt;other&lt;/code&gt; user level&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/usr/bin/mount&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SUID&lt;/code&gt; flag set because only the &lt;code&gt;root&lt;/code&gt; can mount filesystems, but when &lt;code&gt;/etc/fstab&lt;/code&gt; contains the &lt;code&gt;user&lt;/code&gt; option, anybody can mount the corresponding filesystem&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SGID&lt;/code&gt; (&lt;strong&gt;Set Group ID&lt;/strong&gt;) flag — works both on files and directories

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;On files&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;A process executing a file keeps its effective &lt;code&gt;GID&lt;/code&gt; (&lt;strong&gt;Group ID&lt;/strong&gt;) the same as &lt;code&gt;GID&lt;/code&gt; of the user running the executable&lt;/li&gt;
&lt;li&gt;If the executable file has the &lt;code&gt;SGID&lt;/code&gt; flag set, the process sets its effective &lt;code&gt;GID&lt;/code&gt; equals to the file's &lt;code&gt;group&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Due to security reason &lt;code&gt;SGID&lt;/code&gt; flag works only on Linux ELF executables, meaning it does nothing on a &lt;code&gt;Bash&lt;/code&gt; or &lt;code&gt;Python&lt;/code&gt; scripts files&lt;/li&gt;
&lt;li&gt;Examples of well-known Linux system executables with &lt;code&gt;SGID&lt;/code&gt; flag set&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/usr/bin/ssh-agent&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SGID&lt;/code&gt; flag set &lt;em&gt;to prevent &lt;code&gt;ptrace(2)&lt;/code&gt; attacks retrieving private key material&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/usr/bin/crontab&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SGID&lt;/code&gt; flag set to provide the following restrictions (together with &lt;code&gt;crontab&lt;/code&gt; binary owned by &lt;code&gt;crontab&lt;/code&gt; group, and &lt;code&gt;crontab&lt;/code&gt; spool directory owned by &lt;code&gt;crontab&lt;/code&gt; group and &lt;code&gt;Sticky bit&lt;/code&gt; set on it)&lt;/li&gt;
&lt;li&gt;limiting access to &lt;code&gt;crontab&lt;/code&gt; spool directory (&lt;code&gt;/var/spool/cron/crontabs&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;limiting edit or read access to users' &lt;code&gt;crontab&lt;/code&gt; files (&lt;code&gt;/var/spool/cron/crontabs/&amp;lt;username&amp;gt;&lt;/code&gt;) only via &lt;code&gt;crontab&lt;/code&gt; binary &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;On directories&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;When a file is created by a process, its &lt;code&gt;GID&lt;/code&gt; (&lt;strong&gt;Group ID&lt;/strong&gt;) can be either the &lt;code&gt;GID&lt;/code&gt; of the creator process or the &lt;code&gt;GID&lt;/code&gt; of the parent directory, depending on the value of the &lt;code&gt;SGID&lt;/code&gt; flag of the parent directory&lt;/li&gt;
&lt;li&gt;This behavior is applied only to &lt;code&gt;SGID&lt;/code&gt; flag, but not to &lt;code&gt;SUID&lt;/code&gt; flag, &lt;code&gt;SUID&lt;/code&gt; flag doesn't have such a behavior
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SGID&lt;/code&gt; on directories is used for creating collaborative directories where some users work together on some project and belong to the same &lt;code&gt;group&lt;/code&gt; and should be able to see each other's files providing read file permission on that &lt;code&gt;group&lt;/code&gt; level&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Sticky bit&lt;/code&gt; — currently works only on directories (using it on files is deprecated)

&lt;ul&gt;
&lt;li&gt;
&lt;del&gt;&lt;em&gt;On files&lt;/em&gt;&lt;/del&gt;

&lt;ul&gt;
&lt;li&gt;This approach has become obsolete and is deprecated now, &lt;em&gt;sharing of code pages&lt;/em&gt; is used&lt;/li&gt;
&lt;li&gt;&lt;del&gt;Running an executable file with the &lt;code&gt;Sticky bit&lt;/code&gt; set requests the kernel to keep the program in memory after its execution terminates&lt;/del&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;On directories&lt;/em&gt;

&lt;ul&gt;
&lt;li&gt;With the &lt;code&gt;Sticky bit&lt;/code&gt; set on a directory, only the file's &lt;code&gt;owner&lt;/code&gt;, the directory's &lt;code&gt;owner&lt;/code&gt;, or &lt;code&gt;root&lt;/code&gt; user can modify (for example delete or rename) the files and subdirectories in the directory&lt;/li&gt;
&lt;li&gt;Without the &lt;code&gt;Sticky bit&lt;/code&gt; set on a directory, any user with &lt;code&gt;write&lt;/code&gt; and &lt;code&gt;execute&lt;/code&gt; permissions for the directory can modify contained files and subdirectories in the directory, regardless of the their &lt;code&gt;owners&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If a user wants to create files and subdirectories in some directory, he/she needs &lt;code&gt;write&lt;/code&gt; and &lt;code&gt;exectute&lt;/code&gt; permissions on that directory&lt;/li&gt;
&lt;li&gt;These &lt;code&gt;write&lt;/code&gt; and &lt;code&gt;exectute&lt;/code&gt; permissions on the directory gives the user the privilege to create files and subdirectories as well as the privilege to modify them&lt;/li&gt;
&lt;li&gt;At the same time the user can modify any files or subdirectories in this directory, the permissions of those files and subdirectories do not have any effect on modification&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;Sticky bit&lt;/code&gt; set on a directory, anyone can create files in the directory, but can modify his/her own files only - files owned by other users cannot be modified&lt;/li&gt;
&lt;li&gt;Examples of well-known Linux system directories with &lt;code&gt;SGID&lt;/code&gt; flag set&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/tmp&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Sticky bit&lt;/code&gt; is used for &lt;code&gt;/tmp&lt;/code&gt; directory because it has to have all the rights on all the user's permission triads allowing all the users to create/delete their temporary files there&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/var/spool/cron/crontabs&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;For details why the &lt;code&gt;Sticky bit&lt;/code&gt; is used here, see the explanation of &lt;code&gt;SGID&lt;/code&gt; flag set on &lt;code&gt;/usr/bin/crontab&lt;/code&gt; above&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;SUID&lt;/code&gt;, &lt;code&gt;SGID&lt;/code&gt;, and &lt;code&gt;Sticky bit&lt;/code&gt; examples &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Effects of &lt;code&gt;SUID&lt;/code&gt; flag &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user3@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;which &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo chown &lt;/span&gt;user1 ./id
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo chmod &lt;/span&gt;u+s ./id
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; ./id
&lt;span class="nt"&gt;-rwsr-xr-x&lt;/span&gt; 1 user1 user3 47480 Jul 26 11:07 ./id

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;id
&lt;/span&gt;&lt;span class="nv"&gt;uid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;gid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt;

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;./id
&lt;span class="nv"&gt;uid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;gid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;euid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2001&lt;span class="o"&gt;(&lt;/span&gt;user1&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;SGID&lt;/code&gt; flag on files &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user3@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;which &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo chgrp &lt;/span&gt;user2 ./id
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo chmod &lt;/span&gt;g+s ./id
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; ./id
&lt;span class="nt"&gt;-rwxr-sr-x&lt;/span&gt; 1 user3 user2 47480 Jul 26 11:13 ./id

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;id
&lt;/span&gt;&lt;span class="nv"&gt;uid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;gid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt;

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;./id
&lt;span class="nv"&gt;uid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;gid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;egid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2002&lt;span class="o"&gt;(&lt;/span&gt;user2&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2002&lt;span class="o"&gt;(&lt;/span&gt;user2&lt;span class="o"&gt;)&lt;/span&gt;,2003&lt;span class="o"&gt;(&lt;/span&gt;user3&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;SGID&lt;/code&gt; flag on directories &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;SGID&lt;/code&gt; flag is not set the created file get its &lt;code&gt;GID&lt;/code&gt; from the creator process
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user3@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"#/usr/bin/env bash"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"touch test"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x file

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo chgrp &lt;/span&gt;user1 ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwxr-x   2 user3    user1        4096 Jul 27 06:25 &lt;span class="nb"&gt;.&lt;/span&gt;
   258938      4 &lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt;   1 user3    user3          30 Jul 27 06:25 ./file

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;./file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwxr-x   2 user3    user1        4096 Jul 27 06:26 &lt;span class="nb"&gt;.&lt;/span&gt;
   258938      4 &lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt;   1 user3    user3          30 Jul 27 06:25 ./file
   258941      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user3    user3           0 Jul 27 06:26 ./test
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;SGID&lt;/code&gt; flag is set the created file get its &lt;code&gt;GID&lt;/code&gt; from the parent directory
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user3@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"#/usr/bin/env bash"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"touch test"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x file

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;g+s ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo chgrp &lt;/span&gt;user1 ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwsr-x   2 user3    user1        4096 Jul 27 06:27 &lt;span class="nb"&gt;.&lt;/span&gt;
   258938      4 &lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt;   1 user3    user3          30 Jul 27 06:27 ./file

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;./file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwsr-x   2 user3    user1        4096 Jul 27 06:27 &lt;span class="nb"&gt;.&lt;/span&gt;
   258938      4 &lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt;   1 user3    user3          30 Jul 27 06:27 ./file
   258941      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user3    user1           0 Jul 27 06:27 ./test
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  No effects of &lt;code&gt;SUID&lt;/code&gt; flag on directories &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Even if &lt;code&gt;SUID&lt;/code&gt; flag is set, it has no effect on a directory
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user3@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"#/usr/bin/env bash"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"touch test"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x file

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;u+s ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo chown &lt;/span&gt;user2 ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwsrwxr-x   2 user2    user3        4096 Jul 27 06:29 &lt;span class="nb"&gt;.&lt;/span&gt;
   258938      4 &lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt;   1 user3    user3          30 Jul 27 06:30 ./file

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;./file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwsrwxr-x   2 user2    user3        4096 Jul 27 06:30 &lt;span class="nb"&gt;.&lt;/span&gt;
   258938      4 &lt;span class="nt"&gt;-rwxrwxr-x&lt;/span&gt;   1 user3    user3          30 Jul 27 06:30 ./file
   258941      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user3    user3           0 Jul 27 06:30 ./test
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Effects of &lt;code&gt;Sticky bit&lt;/code&gt; &lt;a&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;Sticky bit&lt;/code&gt; is not set it allows &lt;code&gt;user1&lt;/code&gt; to delete files of &lt;code&gt;user3&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user3@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+rwx ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;user3-file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;user3-dir
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwxrwx   3 user3    user3        4096 Jul 27 07:08 &lt;span class="nb"&gt;.&lt;/span&gt;
   258941      4 drwxrwxr-x   2 user3    user3        4096 Jul 27 07:08 ./user3-dir
   258938      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user3    user3           0 Jul 27 07:07 ./user3-file

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
/home/user3/tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; user1
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /home/user3/tmp

user1@ubuntu20lts:/home/user3/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwxrwx   3 user3    user3        4096 Jul 27 07:08 &lt;span class="nb"&gt;.&lt;/span&gt;
   258941      4 drwxrwxr-x   2 user3    user3        4096 Jul 27 07:08 ./user3-dir
   258938      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user3    user3           0 Jul 27 07:07 ./user3-file

user1@ubuntu20lts:/home/user3/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; user3&lt;span class="k"&gt;*&lt;/span&gt;
user1@ubuntu20lts:/home/user3/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwxrwx   2 user3    user3        4096 Jul 27 07:09 &lt;span class="nb"&gt;.&lt;/span&gt;

user1@ubuntu20lts:/home/user3/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;logout
&lt;/span&gt;user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258932      4 drwxrwxrwx   2 user3    user3        4096 Jul 27 07:09 &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;Sticky bit&lt;/code&gt; is set it doesn't allow &lt;code&gt;user1&lt;/code&gt; to delete files of &lt;code&gt;user3&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;user3@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;tmp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+rwx ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;o+t ./
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;user3-file
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;user3-dir
user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258917      4 drwxrwxrwt   3 user3    user3        4096 Jul 27 07:42 &lt;span class="nb"&gt;.&lt;/span&gt;
   258932      4 drwxrwxr-x   2 user3    user3        4096 Jul 27 07:42 ./user3-dir
   258918      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user3    user3           0 Jul 27 07:42 ./user3-file

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
/home/user3/tmp

user3@ubuntu20lts:~/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; user1
user1@ubuntu20lts:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /home/user3/tmp

user1@ubuntu20lts:/home/user3/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt;
   258917      4 drwxrwxrwt   3 user3    user3        4096 Jul 27 07:42 &lt;span class="nb"&gt;.&lt;/span&gt;
   258932      4 drwxrwxr-x   2 user3    user3        4096 Jul 27 07:42 ./user3-dir
   258918      0 &lt;span class="nt"&gt;-rw-rw-r--&lt;/span&gt;   1 user3    user3           0 Jul 27 07:42 ./user3-file

user1@ubuntu20lts:/home/user3/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./user3-file
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./user3-file'&lt;/span&gt;: Operation not permitted

user1@ubuntu20lts:/home/user3/tmp&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-fr&lt;/span&gt; ./user3-dir
&lt;span class="nb"&gt;rm&lt;/span&gt;: cannot remove &lt;span class="s1"&gt;'./user3-dir'&lt;/span&gt;: Operation not permitted
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5tRjR2Ag--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cjohm7k0hveqe46gg5dt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5tRjR2Ag--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cjohm7k0hveqe46gg5dt.jpg" alt="FlowerPuzzleB"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>security</category>
      <category>bash</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>How to set Git for multiple GitHub accounts</title>
      <dc:creator>mtilson</dc:creator>
      <pubDate>Thu, 30 Apr 2020 15:57:43 +0000</pubDate>
      <link>https://dev.to/mtilson/how-to-set-git-for-multiple-github-accounts-3kbn</link>
      <guid>https://dev.to/mtilson/how-to-set-git-for-multiple-github-accounts-3kbn</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7vmaQlZ8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oel4yhy4ubilnw54t7mi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7vmaQlZ8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oel4yhy4ubilnw54t7mi.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's say we have GitHub &lt;code&gt;org&lt;/code&gt; with &lt;code&gt;team&lt;/code&gt; of 2 members (&lt;code&gt;member1&lt;/code&gt;, &lt;code&gt;member2&lt;/code&gt;) having &lt;code&gt;Write&lt;/code&gt; access to a &lt;code&gt;repo&lt;/code&gt; with URL of &lt;code&gt;https://github.com/org/repo.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We are going to setup Git (repository and global options) on macOS to be able to commit to the &lt;code&gt;repo&lt;/code&gt; using the above GitHub user accounts including different network authentication&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure macOS system credential helper
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--system&lt;/span&gt; credential.helper osxkeychain
git config &lt;span class="nt"&gt;--system&lt;/span&gt; credential.usehttppath &lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Remove user personal name and email from system configuration
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--system&lt;/span&gt; &lt;span class="nt"&gt;--unset&lt;/span&gt; user.name
git config &lt;span class="nt"&gt;--system&lt;/span&gt; &lt;span class="nt"&gt;--unset&lt;/span&gt; user.email
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Setup &lt;code&gt;member1&lt;/code&gt; account
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;login member1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Get repo
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/projects
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/projects
git clone https://github.com/org/repo.git
&lt;span class="nb"&gt;cd &lt;/span&gt;repo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Setup user personal name and email
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git config user.name member1
git config user.email member1@email.io
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Setup authentication credentials
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git config credential.username member1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Repeat the above steps for &lt;code&gt;member2&lt;/code&gt; account
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;login member2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Get repo
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/projects
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/projects
git clone https://github.com/org/repo.git
&lt;span class="nb"&gt;cd &lt;/span&gt;repo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Setup user personal name and email
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git config user.name member2
git config user.email member2@email.io
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Setup authentication credentials
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git config credential.username member2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now user names, emails, and credential names are stored in the corresponding repo's &lt;code&gt;.git/config&lt;/code&gt; and will be used by Git to push commits to GitHub on behalf of the corresponding users&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Vc5RbMro--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/e0q3tkukfav7gvrvood9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vc5RbMro--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/e0q3tkukfav7gvrvood9.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
    </item>
  </channel>
</rss>
