A .netrc file is a simple way to store login details (like user names and passwords) so applications can automatically authenticate to servers without asking you every time. The .netrc file is hidden in your home directory on you local machine.

Creating a .netrc file

If you want to use a .netrc file to access postgreSQL, create a file named .netrc in the home directory of your machine and enter the credentials by stating machine, login and password:

machine postgresql login <superuser> password <passphrase>

Where machine is the code word you send to .netrc for the resource you want to access, and login and password are the credentials on the resource you are trying to enter.

Updated: