public static String getUnixFilePermissions(String path) {
    String result = MASK_EVERYBODY_RWX;
    if (LINUX) {
      try {
        result = runCommand(new String[]{"stat", "-c", "%a", path}).getStdout();
      } catch (IOException | InterruptedException e) {
        // Improbable
        LOG.warn(String.format("Can not perform stat on %s", path), e);
      }
    } else {
      LOG.debug(String.format("Not performing stat -s \"%%a\" command on file %s " +
          "because current OS is not Linux. Returning 777", path));
    }
    return result.trim();
  }
Gets file permissions on Linux systems.
Under Windows/Mac, command always returns MASK_EVERYBODY_RWX

@param path
ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java