You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-user@hadoop.apache.org by Petru Dimulescu <pe...@gmail.com> on 2011/11/29 12:54:08 UTC

connect to hdfs as arbitrary user

Hello,

I would like to connect to hdfs as another user than my unix login. How 
can I do that?

I am most intersted how can I change the current user programmatically 
at DFSClient level; but if there are any command-line options i am 
interested too, I will take a look at the code that implements them.

Thanks
Petru

Re: connect to hdfs as arbitrary user

Posted by Petru Dimulescu <pe...@gmail.com>.
Thank you. Indeed, it's about creating a Filesystem client, using

UserGroupInformation ugi.doAs( ....
...
     FileSystem.get(conf)
)

instead of the plain .get(conf) call.

the problem is how you get the ugi. You can do, as discussed in that url :

UserGroupInformation.createProxyUser("someuser", 
UserGroupInformation.getCurrentUser())

which creates some kind of stacked identity, the current user being the 
fallback identity. You also need to configure HDFS to allow the "current 
user" to act as a super-user and change identity.

As for myself I settled to using the 
UserGroupInformation.createRemoteUser(String) which just creates a user 
with no credentials and works.

Best,
Petru

On 11/29/2011 01:41 PM, Harsh J wrote:
> Petru,
>
> Take a look at this conversation that came up some time ago: http://search-hadoop.com/m/BspSb2Wf38t
>
> On 29-Nov-2011, at 5:24 PM, Petru Dimulescu wrote:
>
>> Hello,
>>
>> I would like to connect to hdfs as another user than my unix login. How can I do that?
>>
>> I am most intersted how can I change the current user programmatically at DFSClient level; but if there are any command-line options i am interested too, I will take a look at the code that implements them.
>>
>> Thanks
>> Petru


Re: connect to hdfs as arbitrary user

Posted by Harsh J <ha...@cloudera.com>.
Petru,

Take a look at this conversation that came up some time ago: http://search-hadoop.com/m/BspSb2Wf38t

On 29-Nov-2011, at 5:24 PM, Petru Dimulescu wrote:

> Hello,
> 
> I would like to connect to hdfs as another user than my unix login. How can I do that?
> 
> I am most intersted how can I change the current user programmatically at DFSClient level; but if there are any command-line options i am interested too, I will take a look at the code that implements them.
> 
> Thanks
> Petru