Return-Path: X-Original-To: apmail-hadoop-common-user-archive@www.apache.org Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1930A17480 for ; Mon, 29 Sep 2014 20:51:17 +0000 (UTC) Received: (qmail 96752 invoked by uid 500); 29 Sep 2014 20:51:11 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 96624 invoked by uid 500); 29 Sep 2014 20:51:11 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 96608 invoked by uid 99); 29 Sep 2014 20:51:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Sep 2014 20:51:11 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of xiaohua.chen@gmail.com designates 209.85.215.42 as permitted sender) Received: from [209.85.215.42] (HELO mail-la0-f42.google.com) (209.85.215.42) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Sep 2014 20:50:45 +0000 Received: by mail-la0-f42.google.com with SMTP id mk6so2625786lab.1 for ; Mon, 29 Sep 2014 13:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=W+xGeXdODFcsqPoKn4ju2debVANh9+OaGrQxfmRVppk=; b=vJRBJXor9iwwlB3ppLG5X933+zxmFkkFEd50aODKs4TYZZ+1dXnGc3cJP+mccJkG3K 40MbAuBb5Le/Njax6XskxOh1J0hEhiw0teJtPJFs5tDNw9T/owUdY+TUrXRAo330bfvI Xohr4a+MTTZJRD570555QJSFoP5YDJaXrwz2P71Dys3N+QoVSwxYzB1LjSIx5Y/QuSVd GncBxTbfhf0IfoZhmGuFnfuif0vh3K8wwb9AiepsjU02Sd7cQ3K7FqpF9CXFh1n5gQ3e SBbLCrEaFVF/bPO60FNpG7W8dgGWbHIrmUvx7T9OHyprke51T/oBPc8fmXza2QwkPfFc EaOg== MIME-Version: 1.0 X-Received: by 10.152.87.170 with SMTP id az10mr42472308lab.20.1412023844905; Mon, 29 Sep 2014 13:50:44 -0700 (PDT) Received: by 10.114.185.199 with HTTP; Mon, 29 Sep 2014 13:50:44 -0700 (PDT) Date: Mon, 29 Sep 2014 13:50:44 -0700 Message-ID: Subject: Kerberosed Hadoop HDFS From: Xiaohua Chen To: user@hadoop.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Hi Experts: I write the following java program to access Kerberosed Hadoop File system: ----------------------------------------------- import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileStatus; import java.net.URI; public class HDFSExample { public static void main(String[] args) throws Exception{ Path path = new Path("/user/sochen"); if ( args.length == 1){ path = new Path(args[0]); } Configuration conf = new Configuration(); System.out.println("fs.defaultFS = " + conf.get("fs.defaultFS")); URI uri = new URI("hdfs://my.namenode.com:8020"); FileSystem fs = FileSystem.get(uri, conf); System.out.println("List of files in " + path); FileStatus [] files = fs.listStatus(path); for (FileStatus file : files ){ System.out.println(file.getPath().getName()); } } } ------------------------------------------------------ It work fine as long as I issued kinit for my principal "sochen" (which is also my current linux login account user name). But if I changed one line above from: FileSystem fs = FileSystem.get(uri, conf); to FileSystem fs = FileSystem.get(uri, conf, "sochen"), I will hit below error: 14/09/29 13:47:32 ERROR security.UserGroupInformation: PriviledgedActionException as:sochen (auth:SIMPLE) cause:javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)] What I want to do is: to specify a username "sochen" to explicitly to get a FileSystem, but underneath hadoop changed the authentication mode to "SIMPLE" , why ? Then how can I get a FileSystem based on a login user ? Thanks. Sophia