Enable postgresql passwordless login

Enable postgresql passwordless login

In this tutorial I will show you how to enable postgresql passwordless login for any postgresql whether it is local postgresql server or it is remote postgresql server. After passwordless login you don’t need to type password again and again.


postgresql passwordless login

Step 1. Open the .pgpass file with your favourite editor. pgpass file will be in your home directory.

vim ~/.pgpass

See Also: How to install postgresql 9.6 on centos 7

Step 2. Enter the credentials of your postgresql server in the file as per following format.


I will try to login into postgresql server on my localhost.

[root@installvirtual ~]# psql -U postgres -h localhost
Password for user postgres:
psql (9.6.4)
Type "help" for help.

It is asking for password. Now, I will add details of my postgresql server that is installed on my localhost. Username and password of my postgresql server is postgres.


Read Also: Install postgresql 9.6 on mac

Step 3. Change the file permissions

chmod 0600 ~/.pgpass

Let’s try to login.

[root@installvirtual ~]# psql -U postgres -h localhost
psql (9.6.4)
Type "help" for help.

You can see i am able to login with the password. You can add a password of any remote server also.

If there are any issues in setting up of password less login please feel free to comment below.

Video Tutorial

Read Also: How to install postgresql on Ubuntu 16.04


Leave a Reply

Your email address will not be published.


The reCAPTCHA verification period has expired. Please reload the page.

48-Hour Flash Sale! Courses from just $10.99