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,

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of