Using Hive with PAM Authentication
PAM authentication for Hive
In some situations an organization does not have an LDAP server and does not want to use Kerberos for the authentication, since this complicates the integration with third-party software.
A quick alternative is PAM authentication which is in Hive since HDP2.2. It uses the OS users and passwords of the host running the hiveserver2 for authentication.
The examples below are done using HDP 2.2/2.3 and Redhat.
1. Install JPam
- Download JPam library and unzip on the hive host: JPam Libraries
- Copy the .so file into the library path of the hive server.
An easy way to find this is to use
ps -ef | grep hiveserver2
and find the -Djava.library.path variable.
For example copy the .so file to the following folder:
/usr/hdp/2.2.4.2-2/hadoop/lib/native/Linux-amd64-64
2. Make shadow file accessible to hive user
/etc/shadow needs to be readable by hive:
chgrp hive /etc/shadow
chmod 550 /etc/shadow
The wiki entry also says to make /etc/login.defs accessible but this doesn't seem to be necessary for the PAM modules I used.
Wiki entry: Hive Security Wiki
3. Set PAM authentication
In Ambari switch authentication to PAM hive.server2.authentication = PAM
4. Set PAM modules
Different possibilities, what worked for me was login, sshd: hive.server2.authentication.pam.services=login,sshd
5. Restart the hive server
You should now be able to login with username, password of the hiveserver2 host users. No kerberos problems no LDAP connection problems.
Note there are good reasons to use Kerberos or Knox because these support encryption and if you have an LDAP environment this is definitely also a good option. But for a quick authentication configuration in an environment that accesses the server over secure networks PAM is a good option.
6. Getting Hue to run with PAM authentication
Hue 2.6 does not officially support PAM. However LDAP works the same for Hue.
- Make a copy of your hive configuration ( for example into /etc/hue/hive-conf )
- Change the authentication setting in the copy to LDAP
- Point hue to this configuration
- Enter the valid hue user, password as "LDAP user"

