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 Michael Lok <fu...@gmail.com> on 2012/01/17 04:14:09 UTC

Specifying username using ClientProtocol

Hi folks,

I'm trying to connect to a NameNode using Hadoop's RPC ClientProtocol
class.  Code below:

InetSocketAddress address = new InetSocketAddress("namenode", 9000);

Configuration conf = new Configuration();

ClientProtocol client =
	(ClientProtocol) RPC.waitForProxy(ClientProtocol.class,
ClientProtocol.versionID, address, conf);

System.out.println(client.getStats());

Unfortunately, my currently logged in user name is not the user who's
configured on the server; hence the following exception:

org.apache.hadoop.ipc.RemoteException:
org.apache.hadoop.security.AccessControlException: Access denied for
user mike. Superuser privilege is required

Is there a configuration property key I can set in the configuration
object to override the system username?


Thanks.

Re: Specifying username using ClientProtocol

Posted by Harsh J <ha...@cloudera.com>.
Yes but its not a client-usable, stable API class. The NameNode too is
a service, not a directly user-usable object. The interface changes
from release to release, and methods may get added/deprecated/removed
without us considering the user impact cause it isn't meant to be a
user class.

For all filesystem operations, limit to using only the
FileSystem/FileContext class.

But, what are you using the ClientProtocol for?

On Wed, Feb 1, 2012 at 7:51 PM, Michael Lok <fu...@gmail.com> wrote:
> Hi Harsh,
>
> Why do you consider ClientProtocol to be an unsupported and non-public
> class/interface?  Isn't that what the concrete Namenode class is based
> on?
>
>
> Thanks.
>
> On Wed, Feb 1, 2012 at 8:16 PM, Harsh J <ha...@cloudera.com> wrote:
>> Michael,
>>
>> These are non-public, unsupported classes you are trying to use here.
>> We'd not recommend doing that unless your goal was to experiment with
>> something at most.
>>
>> But to technically answer your question, you can get over this if you
>> disable permissions itself on the HDFS level. Impersonating the
>> superuser is not allowed. Or another alternative would be to add your
>> user to the designated HDFS supergroup, and elevate its rights that
>> way.
>>
>> On Tue, Jan 17, 2012 at 8:44 AM, Michael Lok <fu...@gmail.com> wrote:
>>> Hi folks,
>>>
>>> I'm trying to connect to a NameNode using Hadoop's RPC ClientProtocol
>>> class.  Code below:
>>>
>>> InetSocketAddress address = new InetSocketAddress("namenode", 9000);
>>>
>>> Configuration conf = new Configuration();
>>>
>>> ClientProtocol client =
>>>        (ClientProtocol) RPC.waitForProxy(ClientProtocol.class,
>>> ClientProtocol.versionID, address, conf);
>>>
>>> System.out.println(client.getStats());
>>>
>>> Unfortunately, my currently logged in user name is not the user who's
>>> configured on the server; hence the following exception:
>>>
>>> org.apache.hadoop.ipc.RemoteException:
>>> org.apache.hadoop.security.AccessControlException: Access denied for
>>> user mike. Superuser privilege is required
>>>
>>> Is there a configuration property key I can set in the configuration
>>> object to override the system username?
>>>
>>>
>>> Thanks.
>>
>>
>>
>> --
>> Harsh J
>> Customer Ops. Engineer
>> Cloudera | http://tiny.cloudera.com/about



-- 
Harsh J
Customer Ops. Engineer
Cloudera | http://tiny.cloudera.com/about

Re: Specifying username using ClientProtocol

Posted by Michael Lok <fu...@gmail.com>.
Hi Harsh,

Why do you consider ClientProtocol to be an unsupported and non-public
class/interface?  Isn't that what the concrete Namenode class is based
on?


Thanks.

On Wed, Feb 1, 2012 at 8:16 PM, Harsh J <ha...@cloudera.com> wrote:
> Michael,
>
> These are non-public, unsupported classes you are trying to use here.
> We'd not recommend doing that unless your goal was to experiment with
> something at most.
>
> But to technically answer your question, you can get over this if you
> disable permissions itself on the HDFS level. Impersonating the
> superuser is not allowed. Or another alternative would be to add your
> user to the designated HDFS supergroup, and elevate its rights that
> way.
>
> On Tue, Jan 17, 2012 at 8:44 AM, Michael Lok <fu...@gmail.com> wrote:
>> Hi folks,
>>
>> I'm trying to connect to a NameNode using Hadoop's RPC ClientProtocol
>> class.  Code below:
>>
>> InetSocketAddress address = new InetSocketAddress("namenode", 9000);
>>
>> Configuration conf = new Configuration();
>>
>> ClientProtocol client =
>>        (ClientProtocol) RPC.waitForProxy(ClientProtocol.class,
>> ClientProtocol.versionID, address, conf);
>>
>> System.out.println(client.getStats());
>>
>> Unfortunately, my currently logged in user name is not the user who's
>> configured on the server; hence the following exception:
>>
>> org.apache.hadoop.ipc.RemoteException:
>> org.apache.hadoop.security.AccessControlException: Access denied for
>> user mike. Superuser privilege is required
>>
>> Is there a configuration property key I can set in the configuration
>> object to override the system username?
>>
>>
>> Thanks.
>
>
>
> --
> Harsh J
> Customer Ops. Engineer
> Cloudera | http://tiny.cloudera.com/about

Re: Specifying username using ClientProtocol

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

These are non-public, unsupported classes you are trying to use here.
We'd not recommend doing that unless your goal was to experiment with
something at most.

But to technically answer your question, you can get over this if you
disable permissions itself on the HDFS level. Impersonating the
superuser is not allowed. Or another alternative would be to add your
user to the designated HDFS supergroup, and elevate its rights that
way.

On Tue, Jan 17, 2012 at 8:44 AM, Michael Lok <fu...@gmail.com> wrote:
> Hi folks,
>
> I'm trying to connect to a NameNode using Hadoop's RPC ClientProtocol
> class.  Code below:
>
> InetSocketAddress address = new InetSocketAddress("namenode", 9000);
>
> Configuration conf = new Configuration();
>
> ClientProtocol client =
>        (ClientProtocol) RPC.waitForProxy(ClientProtocol.class,
> ClientProtocol.versionID, address, conf);
>
> System.out.println(client.getStats());
>
> Unfortunately, my currently logged in user name is not the user who's
> configured on the server; hence the following exception:
>
> org.apache.hadoop.ipc.RemoteException:
> org.apache.hadoop.security.AccessControlException: Access denied for
> user mike. Superuser privilege is required
>
> Is there a configuration property key I can set in the configuration
> object to override the system username?
>
>
> Thanks.



-- 
Harsh J
Customer Ops. Engineer
Cloudera | http://tiny.cloudera.com/about