Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Create new hive user

Solved Go to solution
Highlighted

Create new hive user

New Contributor

I want to create new user for hive. When I installed hive using Ambari I created default hive user but want to create one more user. I know it has to be through HDFS but can some one give me exact commands to run and where should I create that. All hive documentation doesn't give me that option.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Create new hive user

By itself any HDFS user can use Hive.

If you do not have kerberos:

1) Just add the user to Linux with useradd ( or add to your ldap )

2) create user home directory

as user hdfs do

hadoop fs -mkdir /home/myuser

hadoop fs-chown myuser /home/myuser

And that's it you should now be able to run queries as that user.

Now there is a second part for secure clusters

If you have kerberos:

1) Add user to your KDC

2) kinit as the user

3) run hive

Using hiveserver2 with beeline or jdbc driver:

Depends on which security you have configured for hiveserver2

- None, just specify myuser as user ( -n myuser )

- PAM uses Linux so give -n myuser -p myuserlinuxpassword

- LDAP uses an LDAP server lets assume its the same as your linux user

- kerberos needs a kinit and specify the principal in the jdbc url

Finally your user needs access to the tables:

No authorization

- make sure the tables you want to read are readable by that user or enable doAs=false

Ranger

- Add access to the table in Ranger portal

SQLStdAuth

- Grant access to the table using GRANT command

3 REPLIES 3

Re: Create new hive user

By itself any HDFS user can use Hive.

If you do not have kerberos:

1) Just add the user to Linux with useradd ( or add to your ldap )

2) create user home directory

as user hdfs do

hadoop fs -mkdir /home/myuser

hadoop fs-chown myuser /home/myuser

And that's it you should now be able to run queries as that user.

Now there is a second part for secure clusters

If you have kerberos:

1) Add user to your KDC

2) kinit as the user

3) run hive

Using hiveserver2 with beeline or jdbc driver:

Depends on which security you have configured for hiveserver2

- None, just specify myuser as user ( -n myuser )

- PAM uses Linux so give -n myuser -p myuserlinuxpassword

- LDAP uses an LDAP server lets assume its the same as your linux user

- kerberos needs a kinit and specify the principal in the jdbc url

Finally your user needs access to the tables:

No authorization

- make sure the tables you want to read are readable by that user or enable doAs=false

Ranger

- Add access to the table in Ranger portal

SQLStdAuth

- Grant access to the table using GRANT command

Re: Create new hive user

Rising Star
@Benjamin Leonhardi

if I use SQL Authentication using this method, how should I assign passwords to users? For using in DB connection for instance...

Will Hive consider OS level user passwords? If so, should I set a password also for 'hive' user? Does it affect other operations?

Re: Create new hive user

New Contributor

@bleonhardi, How can I connect to Hive with a UNIX/HDFS user?

Let's say I have a user named "newuser". I tried the following, but apparently I am doing something wrong.

% su - newuser
% beeline
beeline> !connect -n newuser -p jdbc:mysql://my.host.com/hive
Don't have an account?
Coming from Hortonworks? Activate your account here