Hello -
I am trying to connect to a Postgres server running on Oracle Virtual Box.
Host and Guest OS: Ubuntu 13.04.
I have HOST port 15432 forwarded to GUEST port 5432.
So while I can log into Postgres from within the GUEST (VM) I can't log into it from the HOST.
And I have Postgres on HOST as well and PSQL works fine there as well.
So the cmd below works on respective GUEST and HOST to connect into respective Postgres with PSQL:
sudo -u postgres psql postgres
However when I use the -p and the -h option:
sudo -h localhost -p 15432 -u postgres psql postgres
As documented here:
PostgreSQL: Documentation: 9.0: psql
Where p is for port and h for hostname.
I get usage error as in:
usage: sudo [-D level] -h | -K | -k | -V
usage: sudo -v [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid]
usage: sudo -l[l] [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-U user name] [-u user name|#uid] [-g groupname|#gid] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid] file ...
...
And when I try the directly as below - I get the errors as below as in Ubuntu it seems you can login as above:
monosij@blue:~$ psql -d postgres -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
monosij@blue:~$ sudo psql -d postgres -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
monosij@blue:~$ sudo psql -d postgres -U postgres -W
Password for user postgres:
psql: FATAL: Peer authentication failed for user "postgres"
monosij@blue:~$ sudo psql -d postgres -U postgres -W
Password for user postgres:
psql: FATAL: Peer authentication failed for user "postgres"
...
Hope I have been clear in my examples and in what I am trying to do.
Thank you for your help.
Monosij
I am trying to connect to a Postgres server running on Oracle Virtual Box.
Host and Guest OS: Ubuntu 13.04.
I have HOST port 15432 forwarded to GUEST port 5432.
So while I can log into Postgres from within the GUEST (VM) I can't log into it from the HOST.
And I have Postgres on HOST as well and PSQL works fine there as well.
So the cmd below works on respective GUEST and HOST to connect into respective Postgres with PSQL:
sudo -u postgres psql postgres
However when I use the -p and the -h option:
sudo -h localhost -p 15432 -u postgres psql postgres
As documented here:
PostgreSQL: Documentation: 9.0: psql
Where p is for port and h for hostname.
I get usage error as in:
usage: sudo [-D level] -h | -K | -k | -V
usage: sudo -v [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid]
usage: sudo -l[l] [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-U user name] [-u user name|#uid] [-g groupname|#gid] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid] file ...
...
And when I try the directly as below - I get the errors as below as in Ubuntu it seems you can login as above:
monosij@blue:~$ psql -d postgres -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
monosij@blue:~$ sudo psql -d postgres -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
monosij@blue:~$ sudo psql -d postgres -U postgres -W
Password for user postgres:
psql: FATAL: Peer authentication failed for user "postgres"
monosij@blue:~$ sudo psql -d postgres -U postgres -W
Password for user postgres:
psql: FATAL: Peer authentication failed for user "postgres"
...
Hope I have been clear in my examples and in what I am trying to do.
Thank you for your help.
Monosij