title: Android shell user has no access to /data/local/tmp even though it is the owner of that folder
body: <p>Some background info:
  My phone is on android 9 and is rooted.</p>
  
  <p>I am trying to build a flutter android app. When I execute <code>flutter run</code>, it fails with this error:</p>
  
  <pre><code>❯ flutter run
  adb shell failed to write the SHA hash: ProcessException: Process "/home/wscp/Android/Sdk/platform-tools/adb" exited abnormally:
  /system/bin/sh: can't create /data/local/tmp/sky.com.example.test_app.sha1: Permission denied
    Command: /home/wscp/Android/Sdk/platform-tools/adb -s da0d543 shell echo -n 75cf727e0e3b43efd656faf8cb2e4c779755b261 &gt;
    /data/local/tmp/sky.com.example.test_app.sha1.
  Error launching application on Redmi Note 7.
  </code></pre>
  
  <p>When I try running adb shell independently, I find that I cannot access <code>/data/local/tmp</code>.</p>
  
  <p>I was able to perform the following actions since I have rooted my phone:</p>
  
  <pre><code>❯ adb shell   
  lavender:/ $ whoami
  shell                                                                                                                                         
  lavender:/ $ ls -la /data/local/tmp
  ls: /data/local/tmp: Permission denied
  1|lavender:/ $ su
  lavender:/ # ls -la /data/local/tmp
  total 24
  drwxrwxrwx 2 shell shell 4096 2019-10-25 10:23 .             &lt;====== !!!
  drwxr-x--x 4 root  root  4096 2019-10-12 16:29 ..
  -rw-rw-rw- 1 root  root  9726 2019-10-12 16:29 build.prop
  -rw-rw-rw- 1 root  root   968 2019-10-12 16:29 cmdline
  </code></pre>
  
  <p>The directory <code>/data/local/tmp</code> seems to belong to shell but shell itself is not able to access that directory!</p>
  
  <p>I also attempted to use the <code>scrcpy</code> tool, which I have successfully used on another device of mine, and it resulted in a similar error:</p>
  
  <pre><code>❯ scrcpy
  INFO: scrcpy 1.11 &lt;https://github.com/Genymobile/scrcpy&gt;
  adb: error: failed to copy '/usr/local/share/scrcpy/scrcpy-server' to '/data/local/tmp/scrcpy-server': remote couldn't create file: Permission denied
  /usr/local/share/scrcpy/scrcpy-server: 0 files pushed. 2.0 MB/s (25454 bytes in 0.012s)
  ERROR: "adb push" returned with value 1
  </code></pre>
  
  <p>Why does this happen, and is there a fix?</p>