title: File.canRead() returns false
body: <p>I have a server client program, with server running on Raspberry Pi (running Linux) and client being a Android application. I am writing a in application file browser, which simply sends a path to the server and in turn server returns the list of files using <code>file.listFiles()</code> (server is written in Java).</p>
  
  <p>I run the server / Java program as <code>sudo</code>, hoping that this would give access to all the files across system, but to my surprise, this user does not have read permissions on <code>/home</code> directory of Pi.</p>
  
  <p>So here is what happens in sequence:</p>
  
  <p>I request <code>file.listFiles(new File("/"));</code> which is sent over socket from Pi to Android app. In the app, before making the next request, I check if I can read the file using <code>file.canRead();</code> and for <code>/home</code> directory, this returns false.</p>
  
  <p>File permissions on Pi:</p>
  
  <pre class="lang-none prettyprint-override"><code>pi@raspberrypi ~ $ ls -l / | grep home
  drwxr-xr-x   3 root root  4096 Dec 31  1969 home
  </code></pre>
  
  <p>How I run my Java server:</p>
  
  <pre class="lang-none prettyprint-override"><code>pi@raspberrypi ~ $ sudo java -cp "/usr/local/lib/bluecovelib/bluecove/target/bluecove-2.1.1-SNAPSHOT.jar:/usr/local/lib/bluecovelib/bluecove-gpl-2.1.1-SNAPSHOT/target/bluecove-gpl-2.1.1-SNAPSHOT.jar:/home/pi/severinteractionutils.jar:." AppConnect
  </code></pre>
  
  <p>Why does <code>sudo</code> user does not have access to <code>/home</code> directory from the Java program?</p>
  
  <p>EDIT:</p>
  
  <p>I ran a simple program on Pi to test if it is because the underlying OS has changed. Apparently it does have an effect.</p>
  
  <pre><code>public class TestFileBrowser {
      public static void main(String[] args) { 
          System.out.println("Hello, World");
          File file = new File("/");
          File [] files = file.listFiles();
          for(int i=0; i&lt;files.length; ++i) {
              if(files[i].getAbsolutePath().equals("/home")) {
                  File homeDir = files[i];
                  if(homeDir.canRead()) {
                      System.out.println("Can Read");
                      if (homeDir.isDirectory()) {
                          System.out.println("Is directory");
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>and here is the console snapshot:</p>
  
  <pre><code>pi@raspberrypi ~ $ sudo javac TestFileBrowser.java 
  pi@raspberrypi ~ $ sudo java TestFileBrowser
  Hello, World
  Can Read
  Is directory
  </code></pre>