Support Questions

Find answers, ask questions, and share your expertise

hide password in beeline

avatar
Super Collaborator

goal is to connect through beeline and pass password as a variable...it just works fine, but we can see the password in plain text if we do ps -ef|grep hive

[root@sandbox ~]# beeline -u 'jdbc:hive2://sandbox.hortonworks.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -n rajesh -w pass WARNING: Use "yarn jar" to launch YARN applications. Connecting to jdbc:hive2://sandbox.hortonworks.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 Connected to: Apache Hive (version 1.2.1000.2.5.0.0-817) Driver: Hive JDBC (version 1.2.1000.2.5.0.0-817) Transaction isolation: TRANSACTION_REPEATABLE_READ Beeline version 1.2.1000.2.5.0.0-817 by Apache Hive 0: jdbc:hive2://sandbox.hortonworks.com:2181/>

1 ACCEPTED SOLUTION

avatar
Super Guru

@Raja Sekhar Chintalapati

If you want your password to be encrypted you need to have SSL enabled and use -ssl=true flag in the connect string.

++++

If a response was helpful to address your matter, please vote and accept the best answer. If you have a better answer, please add it and a moderator will review it and accept it as it stands correct. Thanks.

View solution in original post

5 REPLIES 5

avatar
Super Guru

@Raja Sekhar Chintalapati

The -w option allows you to pass in a password file which contains the password. You should not see the password itself, only the file name. In my example I placed my password in a file called password-file.txt.

Here is my beeline command:

$ beeline -u jdbc:hive2://localhost:10000/default -n admin -w password-file.txt
WARNING: Use "yarn jar" to launch YARN applications.
Connecting to jdbc:hive2://localhost:10000/default
Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000/default: java.net.ConnectException: Connection refused (state=08S01,code=0)
Beeline version 1.2.1000.2.5.0.0-817 by Apache Hive
0: jdbc:hive2://localhost:10000/default (closed)> show tables;
Connected to: Apache Hive (version 1.2.1000.2.5.0.0-817)
Driver: Hive JDBC (version 1.2.1000.2.5.0.0-817)
Transaction isolation: TRANSACTION_REPEATABLE_READ
+------------+--+
|  tab_name  |
+------------+--+
| sample_07  |
| sample_08  |
+------------+--+
2 rows selected (2.918 seconds)

Here is my ps:

$ ps -ef | grep hive
hive      4751     1 27 18:46 ?        00:00:16 /usr/lib/jvm/java/bin/java -Xmx250m -Dhdp.version=2.5.0.0-817 -Djava.net.preferIPv4Stack=true -Dhdp.version=2.5.0.0-817 -Dhadoop.log.dir=/var/log/hadoop/hive -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/usr/hdp/2.5.0.0-817/hadoop -Dhadoop.id.str=hive -Dhadoop.root.logger=INFO,console -Djava.library.path=:/usr/hdp/current/hadoop-client/lib/native/Linux-amd64-64:/usr/hdp/2.5.0.0-817/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xmx250m -Xmx1024m -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=/usr/hdp/2.5.0.0-817/hive/bin/../conf/parquet-logging.properties -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /usr/hdp/2.5.0.0-817/hive/lib/hive-service-1.2.1000.2.5.0.0-817.jar org.apache.hadoop.hive.metastore.HiveMetaStore -hiveconf hive.log.file=hivemetastore.log -hiveconf hive.log.dir=/var/log/hive
hive      4855     1 28 18:46 ?        00:00:17 /usr/lib/jvm/java/bin/java -Xmx250m -Dhdp.version=2.5.0.0-817 -Djava.net.preferIPv4Stack=true -Dhdp.version=2.5.0.0-817 -Dhadoop.log.dir=/var/log/hadoop/hive -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/usr/hdp/2.5.0.0-817/hadoop -Dhadoop.id.str=hive -Dhadoop.root.logger=INFO,console -Djava.library.path=:/usr/hdp/2.5.0.0-817/hadoop/lib/native/Linux-amd64-64:/usr/hdp/2.5.0.0-817/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xmx250m -Xmx512m -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=/usr/hdp/2.5.0.0-817/hive/bin/../conf/parquet-logging.properties -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /usr/hdp/2.5.0.0-817/hive/lib/hive-service-1.2.1000.2.5.0.0-817.jar org.apache.hive.service.server.HiveServer2 --hiveconf hive.aux.jars.path=file:///usr/hdp/current/hive-webhcat/share/hcatalog/hive-hcatalog-core.jar -hiveconf hive.metastore.uris=  -hiveconf hive.log.file=hiveserver2.log -hiveconf hive.log.dir=/var/log/hive
hcat      5366     1 17 18:46 ?        00:00:10 /usr/lib/jvm/java/bin/java -Xmx250m -Dhdp.version=2.5.0.0-817 -Djava.net.preferIPv4Stack=true -Dwebhcat.log.dir=/var/log/webhcat/ -Dlog4j.configuration=file:///usr/hdp/2.5.0.0-817/hive-hcatalog/sbin/../etc/webhcat/webhcat-log4j.properties -Dhdp.version=2.5.0.0-817 -Dhadoop.log.dir=/var/log/hadoop/hcat -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/usr/hdp/2.5.0.0-817/hadoop -Dhadoop.id.str=hcat -Dhadoop.root.logger=INFO,console -Djava.library.path=:/usr/hdp/current/hadoop-client/lib/native/Linux-amd64-64:/usr/hdp/2.5.0.0-817/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xmx250m -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /usr/hdp/2.5.0.0-817/hive-hcatalog/sbin/../share/webhcat/svr/lib/hive-webhcat-1.2.1000.2.5.0.0-817.jar org.apache.hive.hcatalog.templeton.Main
vagrant   6480  5894  7 18:46 pts/2    00:00:01 /usr/lib/jvm/java/bin/java -Xmx250m -Dhdp.version=2.5.0.0-817 -Djava.net.preferIPv4Stack=true -Dhdp.version=2.5.0.0-817 -Dhadoop.log.dir=/var/log/hadoop/vagrant -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/usr/hdp/2.5.0.0-817/hadoop -Dhadoop.id.str=vagrant -Dhadoop.root.logger=INFO,console -Djava.library.path=:/usr/hdp/2.5.0.0-817/hadoop/lib/native/Linux-amd64-64:/usr/hdp/2.5.0.0-817/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xmx250m -Xmx512m -Djava.util.logging.config.file=/usr/hdp/current/hive-client/conf/parquet-logging.properties -Dlog4j.configuration=beeline-log4j.properties -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /usr/hdp/2.5.0.0-817/hive/lib/hive-beeline-1.2.1000.2.5.0.0-817.jar org.apache.hive.beeline.BeeLine -u jdbc:hive2://localhost:10000/default -n admin -w password-file.txt
vagrant   6951  3399  0 18:47 pts/1    00:00:00 grep hive

The actual password is not listed.

avatar
Super Collaborator

@Michael Young thank you for your response, but i do not want to save my password in plain text even for a short period of time.

thanks,

Raj

avatar
Super Guru

@Raja Sekhar Chintalapati

If you want your password to be encrypted you need to have SSL enabled and use -ssl=true flag in the connect string.

++++

If a response was helpful to address your matter, please vote and accept the best answer. If you have a better answer, please add it and a moderator will review it and accept it as it stands correct. Thanks.

avatar
Super Guru

@Raja Sekhar Chintalapati

Did you find any of the responses helpful? If so, please accept the best answer or provide one if you addressed the problem by yourself, different than the responses in this thread.

avatar
Explorer

@Raja Sekhar Chintalapati:

Can you please tell me if you find solution to this problem