[ https://issues.apache.org/jira/browse/HADOOP-19060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xiaoqiao He resolved HADOOP-19060. ---------------------------------- Resolution: Won't Fix > Support hadoop client authentication through keytab configuration. > ------------------------------------------------------------------ > > Key: HADOOP-19060 > URL: https://issues.apache.org/jira/browse/HADOOP-19060 > Project: Hadoop Common > Issue Type: New Feature > Reporter: Zhaobo Huang > Assignee: Zhaobo Huang > Priority: Minor > Labels: pull-request-available > > *Shield references to {{UserGroupInformation}} Class.* > The current HDFS client keytab authentication code is as follows: > {code:java} > Configuration conf = new Configuration(); > conf.addResource(new > Path("/usr/local/service/hadoop/etc/hadoop/hdfs-site.xml")); > conf.addResource(new > Path("/usr/local/service/hadoop/etc/hadoop/core-site.xml")); > UserGroupInformation.setConfiguration(conf); > UserGroupInformation.loginUserFromKeytab("foo", "/var/krb5kdc/foo.keytab"); > FileSystem fileSystem = FileSystem.get(conf); > FileStatus[] fileStatus = fileSystem.listStatus(new Path("/")); > for (FileStatus status : fileStatus) { > System.out.println(status.getPath()); > } {code} > This feature supports configuring keytab information in core-site.xml or hdfs > site.xml. The authentication code is as follows: > {code:java} > Configuration conf = new Configuration(); > conf.addResource(new > Path("/usr/local/service/hadoop/etc/hadoop/hdfs-site.xml")); > conf.addResource(new > Path("/usr/local/service/hadoop/etc/hadoop/core-site.xml")); > FileSystem fileSystem = FileSystem.get(conf); > FileStatus[] fileStatus = fileSystem.listStatus(new Path("/")); > for (FileStatus status : fileStatus) { > System.out.println(status.getPath()); > } {code} > The config of core-site.xml related to authentication is as follows: > {code:java} > <configuration> > <property> > <name>hadoop.security.authentication</name> > <value>kerberos</value> > </property> > <property> > <name>hadoop.client.keytab.principal</name> > <value>foo</value> > </property> > <property> > <name>hadoop.client.keytab.file.path</name> > <value>/var/krb5kdc/foo.keytab</value> > </property> > </configuration> {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org