PostgreSQL: pg_ident.conf to map Operating System Username and Database Username

If you do not know about the role of pg_hba.conf file, visit the below link.

PostgreSQL: How to Allow Remote Connection to Connect Database

PostgreSQL also has a one more file related user access permission and that is pg_ident.conf.
PostgreSQL provides Ident-based authentication and It works by obtaining the client’s operating system user name and using it as the allowed database user name with an optional user name mapping.

When we are using an external authentication system, system username might not be the same as database username.

To allow external authentication, We should map the system username with database username and we can also set a map name to hide the system username and database username related detail.

For example,

Go to the PostgreSQL data directory and Open pg_ident.conf file.
You can find below lines:

You can add value to map system username and database username:

Once you map your system user and database user in pg_ident.conf file, you can use map name in pg_hba.conf file to allow external authentication.

Go to your PostgreSQL data directory and open a pg_hba.conf file.

You can add the map name of system user and database user in METHOD column.
For Example,

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from