I experience some problems using bucardo add db command. It looks like it's unable to connect to other postgreSQL databases.
I tried to do it in several ways. With pg_hba.conf setting
"local" is for Unix domain socket connections only:
local all postgres ident
/usr/local/src/bucardo-5.3.1# ./bucardo add db cd_db dbname=hq
Connection to "cd_db" (PostgreSQL database) as user bucardo failed. You may force add it with the --force argument.
Error was: fe_sendauth: no password supplied
Then with pg_hba.conf setting
"local" is for Unix domain socket connections only:
local all all peer
with postgres credentials:
/usr/local/src/bucardo-5.3.1# ./bucardo add db cd_db dbname=hq db dbuser=postgres
Connection to "cd_db" (PostgreSQL database) as user postgres failed. You may force add it with the --force argument.
Error was: FATAL: Peer authentication failed for user "postgres"
with bucardo credentials:
/usr/local/src/bucardo-5.3.1# ./bucardo add db cd_db dbname=hq db dbuser=bucardo dbpass=bucardo-runner
Connection to "cd_db" (PostgreSQL database) as user bucardo failed.
Error was: FATAL: Peer authentication failed for user "bucardo"
Please help me to figure out what is wrong and how to use the installed bucardo.
I'm running it on Linux Debian, just for reference.
To use ident to login with a different user other than the linux user you will need to map the user in pg_ident.conf.
pg_indet.conf
app root postgres
app root bucardo
app {username} bucardo
pg_hba.conf
local all all ident map=app
Related
I have a ThingsBoard Professional Edition setup using AWS EC2 instance. The database is PostgreSQL-12. I tend to get the following error: FATAL: password authentication failed for user "postgres" FATAL: password authentication failed for user "postgres" when trying to log into the remote database server on pgAdmin4.
Here is a screenshot of the error shown when attempting to log in to server created on pgAdmin4.
Here is how I configured the remote database server (where Host name/address is the Public IPv4 of my EC2 instance).
In postgresql.conf, I have replaced the line listen_address='127.0.0.1' with listen_addresses='*'.
In pg_hba.conf, I added host all all 0.0.0.0/0 md5.
Here is a screenshot of my pg_hba.conf file:
I have also set the password for the user 'postgres' using the psql command #\password.
Here is what is shown in thingboard.log when I run the command:
cat /var/log/thingsboard/thingsboard.log | grep ERROR
Partial screenshot of /var/log/postgresql/postgresql-12-main.log shows the following:
I constantly have to use #ALTER USER postgres PASSWORD ‘<password>’; to be able to overcome this error but the error tends to return when I restart my local Windows machine.
That must be done by some software other than PostgreSQL.
Configure logging by setting log_statement = 'ddl' in postgresql.conf and restarting the database. Then you can more easily figure out when and by which software your password gets changed.
Additionally, configure pg_hba.conf to not allow passwordless connections from anywhere, then change the password. You may see some component start to complain - that component may be at fault.
I am having an issue that has been bothering me for some time now. It is with postgres on my mac. I set a password for postgres and I can not remember it for some reason. I have looked up and attempted several different methods for trying to reset the password but none of them are working and I need it fixed as soon as possible.
Here is what my pg_hba.conf file
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
I reset the local all all trust and then restarted my postgres server running
brew services restart postgres
and when i go to try and open postgres on my terminal I get the same password issue:
omars-MacBook-Pro:postgres omarjandali$ psql -U postgres -W -h localhost
Password:
psql: error: could not connect to server: FATAL: password authentication failed for user "postgres"
or
omars-MacBook-Pro:~ omarjandali$ psql -h 127.0.0.1 -U postgres
Password for user postgres:
psql: error: could not connect to server: FATAL: password authentication failed for user "postgres"`
You only configured "local" connections which are using Unix domain sockets. But your psql command line tries to establish a TCP connection (-h ...), which is not configured in your pg_hba.conf.
You need to use host instead of localin pg_hba.conf to allow trusted, non-password connections through TCP.
But that is a really, really bad idea, because that means that as soon as your Mac is visible on the internet, everybody can connect to your Postgres instance and hack it. This isn't a theoretical threat - there have been numerous posts on this site regarding that.
If you want to allow connections without passwords, at least only allow them from "localhost", not from the outside:
# TYPE DATABASE USER ADDRESS METHOD
host all all samehost trust
I have installed postgresql database and pgadmin4 on my fedora machine.
after starting the postgresql service and trying to connect to postgresql server
from pgadmin4
i am getting this error
Unable to connect to server:
FATAL: Ident authentication failed for user "postgres".
how should i fix this?
Did you create the "postgres" user while installing? You may be using wrong credentials, if you have forgotten the password, please change the pg_hba.conf (then reload or restart postgresql server) to allow all the connections from local without credentials, then change the password for postgres (again reload or restart postgresql) user. Change the pg_hba.conf to use credentials and try logging in.
So I would like to import a local dump to my heroku postgresql db, however, any command I run I just get ...
psql: could not connect to server: Permission denied (0x0000271D/10013)
Is the server running on host "ec2-23-23-192-242.compute-1.amazonaws.com" (23.23.192.242) and accepting
TCP/IP connections on port 5432?
This is using the credentials set by the heroku pg add-on, and I have triple checked them to ensure they are correct. Does anyone know why the hell it keeps giving me Permission denied? I can reset the db from the heroku CLI but I can't perform any other action... weird.
you are behind some strict firewall or just isolated from internet, I assume. Look what I get:
-bash-4.2$ psql -h ec2-23-23-192-242.compute-1.amazonaws.com
Password:
psql: FATAL: password authentication failed for user "postgres"
FATAL: no pg_hba.conf entry for host "xx.xx.xx.xx", user "postgres", database "postgres", SSL off
I have been using postgreSQL, trying to dump plain backup file using command:
psql -U postgres DATABASE < path to file.backup
But getting peer authentication failure. Even tried changing pg_hba.conf from peer to md5, but didn't work.
peer means you are not OS user postgres, while trying to connect as one,
sudo su - postgres
and then psql DBNAME >file.sql
https://www.postgresql.org/docs/current/static/auth-methods.html#AUTH-PEER
The peer authentication method works by obtaining the client's
operating system user name from the kernel and using it as the allowed
database user name (with optional user name mapping). This method is
only supported on local connections.