| 1 | = Postgres HowTo login without password |
| 2 | |
| 3 | tags: [[postgres]] [[HowTo]] |
| 4 | |
| 5 | == Procedure |
| 6 | |
| 7 | 1. Create a file in your home directory called `.pgpass` |
| 8 | 2. The contents of this file should take the format: |
| 9 | {{{ |
| 10 | hostname:port:database:username:password |
| 11 | }}} |
| 12 | |
| 13 | For example, here the port and database have been left blank: |
| 14 | {{{ |
| 15 | localhost:*:*:username:password |
| 16 | }}} |
| 17 | You may have to add a record for `127.0.0.1` as well as `localhost`. |
| 18 | 3. Make sure that the file has the correct permissions by running: `chmod 600 .pgpass` |
| 19 | 4. Connect using the following command: |
| 20 | {{{ |
| 21 | psql -U username -d dbname |
| 22 | }}} |
| 23 | |
| 24 | |
| 25 | |
| 26 | [[BackLinks]] |