<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduce_Compatibility_Hadoop1_Hadoop2.html">Compatibilty between Hadoop 1.x and Hadoop 2.x</a>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img alt="Built by Maven" src="./images/logos/maven-feather.png"/>
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<!-- Licensed under the Apache License, Version 2.0 (the "License"); --><!-- you may not use this file except in compliance with the License. --><!-- You may obtain a copy of the License at --><!-- --><!-- http://www.apache.org/licenses/LICENSE-2.0 --><!-- --><!-- Unless required by applicable law or agreed to in writing, software --><!-- distributed under the License is distributed on an "AS IS" BASIS, --><!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --><!-- See the License for the specific language governing permissions and --><!-- limitations under the License. See accompanying LICENSE file. --><div class="section">
<h2>Superusers Acting On Behalf Of Other Users<a name="Superusers_Acting_On_Behalf_Of_Other_Users"></a></h2>
<ul>
<li><a href="#Superusers_Acting_On_Behalf_Of_Other_Users">Superusers Acting On Behalf Of Other Users</a>
<p>This document describes how a superuser can submit jobs or access hdfs on behalf of another user in a secured way.</p></div>
<div class="section">
<h3>Use Case<a name="Use_Case"></a></h3>
<p>The code example described in the next section is applicable for the following use case.</p>
<p>A superuser with username 'super' wants to submit job and access hdfs on behalf of a user joe. The superuser has kerberos credentials but user joe doesn't have any. The tasks are required to run as user joe and any file accesses on namenode are required to be done as user joe. It is required that user joe can connect to the namenode or job tracker on a connection authenticated with super's kerberos credentials. In other words super is impersonating the user joe.</p></div>
<div class="section">
<h3>Code example<a name="Code_example"></a></h3>
<p>In this example super's kerberos credentials are used for login and a proxy user ugi object is created for joe. The operations are performed within the doAs method of this proxy user ugi object.</p>
<description>The superuser can connect only from host1 and host2 to impersonate a user</description>
</property></pre></div>
<p>If these configurations are not present, impersonation will not be allowed and connection will fail.</p>
<p>If more lax security is preferred, the wildcard value * may be used to allow impersonation from any host or of any user.</p></div>
<div class="section">
<h3>Caveats<a name="Caveats"></a></h3>
<p>The superuser must have kerberos credentials to be able to impersonate another user. It cannot use delegation tokens for this feature. It would be wrong if superuser adds its own delegation token to the proxy user ugi, as it will allow the proxy user to connect to the service with the privileges of the superuser.</p>
<p>However, if the superuser does want to give a delegation token to joe, it must first impersonate joe and get a delegation token for joe, in the same way as the code example above, and add it to the ugi of joe. In this way the delegation token will have the owner as joe.</p></div></div>