public static Map<String, String> hadoopUserEnv(String user,
                          String overrideClasspath) {
    HashMap<String, String> env = new HashMap<String, String>();
    env.put("HADOOP_USER_NAME", user);

    if (overrideClasspath != null) {
      env.put("HADOOP_USER_CLASSPATH_FIRST", "true");
      String cur = System.getenv("HADOOP_CLASSPATH");
      if (TempletonUtils.isset(cur))
        overrideClasspath = overrideClasspath + ":" + cur;
      env.put("HADOOP_CLASSPATH", overrideClasspath);
    }

    return env;
  }
Set the environment variables to specify the hadoop user.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonUtils.java