Chapter 5. Enable Password based Login In Prestodb

Shivani Singh
2 min readJun 8, 2021

To make your prestodb access secure , its always a good idea to enable password based login. Here we will be discussing two password based login methods :
File based authentication and LDAP authentication.
So lets get started.

For both the methods , append below in your config.properties file

http-server.process-forwarded=true
http-server.authentication.type=PASSWORD

1.Password Based Login using a file:

Create a file in the same directory where your config.properties file is located.
These changes are to be done in coordinator node.
Below is the default home_path comes with starburst presto ami

$ touch /var/lib/presto/etc/password-authenticator.properties

now paste the below content and save the file.

password-authenticator.na
me=file
file.password-file=/path/to/password.db

Now create password.db file. You can include a list of usernames and passwords, one per line, separated by a colon in the password file.
All the passwords should be securely hashed using bcrypt or PBKDF2.

touch password.db

Now we have created an empty password file , run below to add/update the password for user john; restart presto service and provide user name with — user flag while login.

$htpasswd -B -C 10 password.db john$ presto --server 127.0.0.1:8080 --catalog hive --user <user_name> 
presto> USE default;
USE
presto:default>

2.Password Based Login using LDAP

Create below file to configure LDAP

password-authenticator.name=ldap
ldap.allow-insecure=true
ldap.url=ldap://<you_ldap_host/url>:<ldap_port>
ldap.user-base-dn=DC=example,DC=com
ldap.user-bind-pattern=uid=${USER},DC=<any_pattern>

once these changes are done restart presto service

service presto restart

Now you can now login to presto using below command:

presto --server 127.0.0.1:8080 --catalog hive --user <user_name> --password  
Password: <enter your LDAP password>
presto> USE default;
USE
presto:default>

Note: You cannot use both the authentication methods together.
To checkout previous chapters in this series , you can follow below links:
Introduction to prestodb
Creating Presto Cluster
Query using prestodb
Deploying Presto Cluster Using AWS marketplace Image

Hope this was helpful!
See you in next Chapter!
Happy Learning!
Shivani S.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Shivani Singh
Shivani Singh

Written by Shivani Singh

DevOps Engineer, Passionate for new tools and Technology!

Responses (1)

Write a response