Chapter 5. Enable Password based Login In Prestodb

  • by
Indus os - presto

To make your prestodb access secure, it’s 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 let’s get started.

For both the methods, append below in your file


1.Password Based Login using a file:

Create a file in the same directory where your 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/

now paste the below content and save the file.

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 --catalog hive --user <user_name> 
presto> USE default;

2.Password Based Login using LDAP

Create the below file to configure LDAP

once these changes are done restart presto service

service presto restart

Now you can now login to presto using the below command:

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

Note: You cannot use both authentication methods together.
To check out 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.

Leave a Reply

Your email address will not be published. Required fields are marked *