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.
Step 1. Open the .pgpass file with your favourite editor. pgpass file will be in your home directory.
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.
[[email protected] ~]# psql -U postgres -h localhost Password for user postgres: psql (9.6.4) Type "help" for help. postgres=#
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.
[[email protected] ~]# psql -U postgres -h localhost psql (9.6.4) Type "help" for help. postgres=#
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.
Read Also: How to install postgresql on Ubuntu 16.04