Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDrNz-0004kC-CN for pgsql-general@arkaria.postgresql.org; Fri, 27 Sep 2019 14:38:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDrNy-0006EN-7M for pgsql-general@arkaria.postgresql.org; Fri, 27 Sep 2019 14:38:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDrNx-0006DQ-5u for pgsql-general@lists.postgresql.org; Fri, 27 Sep 2019 14:38:17 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDrNt-0003uw-8b for pgsql-general@lists.postgresql.org; Fri, 27 Sep 2019 14:38:16 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 119E86ED; Fri, 27 Sep 2019 10:38:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 27 Sep 2019 10:38:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=O VOk8IFhoFQIImv+V19T2TRSngRnax0nos9nuYZ9sS0=; b=18jtt9oqRHoY6FuPJ FE9D2x9QnzS9tXfAjgkRnXQMle4/urhO2+SVNlZPVAWztLoW71REbdiy/zkIC4pj gG67ngf/qvoKyD3QXco7s/ipz3HowudQJmRRaCoHhjatlQ6UiSXVad3kDsvqJRIO DOeOq5w8cBxpWF5loFDDYjehEcxysAj0nF2NUR6BJJlqb962ZSlGzab3SVgT+MUC 0yrwakEm6jnneFWeIT1C4Bl3xSIqRRulfWOOQTS3m0q5OeoXGo4IVMLXMpwehBIS +gVPIGhQ8GYvZgDNv2vWjCm33OwuAt9J6MPM2W/nJeVg+O0WySW41e2AjQz3OOlo vl07w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=OVOk8IFhoFQIImv+V19T2TRSngRnax0nos9nuYZ9s S0=; b=B1AnIJ5ltqOATU3ItXbzJcQYWWuvJ3UYE0WvC8URuOUheevM8Tv8ljR6S 8qw1oEwn4luwMWHajsxLPJ4GQ2vNq/iW+FvoOh1WzBrQv7CYKXTzxNizMYUPk8Vq xMy5zYnoDsBTo2PoNzI189UOHy1RI991ktGSD0lGcAZNBtvVzjXQGSYTfS4qvpMo TDaLXwzqdBiTHV/N3ULVnw8yuplYvmPV3gEgd8jj3BQiay/DApD0KW/WhIDoHSVG jMcR5QqzPsJPJxRq5AOlbx4D3sRHlY5e8gElh5RAHxYK8Wghy3X65JBC08aZSn3e PxkrxmNcpMIusiVDmBQb6lo89uAUQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrfeeigdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuffhomhgrihhnpehusghunhhtuhdrtghomhdpphhoshhtghhrvghsqhhlrdhorhhg pdhmrghnihhtohhuqdhmrghilhdrohhrghenucfkphepjedurddvuddvrdduheekrddufe einecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhl rghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.158.136]) by mail.messagingengine.com (Postfix) with ESMTPA id 9CD86D6005B; Fri, 27 Sep 2019 10:38:08 -0400 (EDT) Subject: Re: "Failed to connect to Postgres database" To: Marco Ippolito , Daniel Verite Cc: pgsql-general@lists.postgresql.org References: <5860c69b-8b16-43b0-ba90-0a0cc7598520@manitou-mail.org> From: Adrian Klaver Message-ID: Date: Fri, 27 Sep 2019 07:38:07 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/27/19 5:58 AM, Marco Ippolito wrote: > Thanks Daniel. > After adding the password, now ssh connection to the cluster fabmnet works: You might want to take a look at: https://help.ubuntu.com/lts/serverguide/postgresql.html > And may be the fact the it's compulsory to add a password is testified > also by the fact that changing the ownership of the database while > adding a password, lets connect with ssh to the database: First it is SSL. Second password and SSL are two different things. This is covered in the auth file pg_hba.conf: https://www.postgresql.org/docs/11/auth-pg-hba-conf.html What you are seeing below is dependent on whether you connect using a host(-h localhost) or a socket(no -h). That behavior is in turn determined by the settings in pg_hba.conf. Also to help down the road when you are setting up the fabric-ca server you need to remember you are now running two Postgres servers: Ver Cluster Port Status Owner Data directory Log file 11 fabmnet 5433 online postgres /var/lib/postgresql/11/fabmnet /var/log/postgresql/postgresql-11-fabmnet.log 11 main 5432 online postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log The most important part is that the fabric server needs to connect to the one using port 5433. FYI, this also means that it is not necesssary to use the --cluster option to psql. Just set the appropriate port -p 5432 for maon and -p 5433 for fabmnet. More below. > > postgres=# CREATE USER fabmnet_admin; > CREATE ROLE > postgres=# ALTER USER fabmnet_admin WITH PASSWORD 'A'; > ALTER ROLE > > postgres=# ALTER DATABASE fabmnet_ca OWNER TO fabmnet_admin; > ALTER DATABASE > postgres=# \l >                                  List of databases >     Name    |     Owner     | Encoding | Collate |  Ctype  |   Access > privileges > ------------+---------------+----------+---------+---------+----------------------- >  fabmnet_ca | fabmnet_admin | UTF8     | C.UTF-8 | C.UTF-8 | >  postgres   | postgres      | UTF8     | C.UTF-8 | C.UTF-8 | >  template0  | postgres      | UTF8     | C.UTF-8 | C.UTF-8 | > =c/postgres          + >             |               |          |         |         | > postgres=CTc/postgres >  template1  | postgres      | UTF8     | C.UTF-8 | C.UTF-8 | > =c/postgres          + >             |               |          |         |         | > postgres=CTc/postgres > (4 rows) > > (base) postgres@pc:~$ psql -h localhost --cluster 11/fabmnet > Password for user postgres: > psql: FATAL:  password authentication failed for user "postgres" > FATAL:  password authentication failed for user "postgres" This failed because you did not specify a database or username, so by default psql used the system user(postgres) as the database name and the user name. I'm guesing you do not have a password set up for the postgres user yet. Pretty sure if you left off the -h localhost you would have connected as Ubuntu sets up trust authentication for postgres user on local socket. > (base) postgres@pc:~$ psql -h localhost --cluster 11/fabmnet -d > fabmnet_ca -U fabmnet_admin > Password for user fabmnet_admin: > psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) > SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: > 256, compression: off) > Type "help" for help. > fabmnet_ca=> > > > Now I have to fix the interface between fabric-ca and postgresql-11 on > both sides. And I will let you know how it is going > > Marco > > Il giorno ven 27 set 2019 alle ore 13:34 Daniel Verite > > ha scritto: > >         Marco Ippolito wrote: > > > (base) postgres@pc:~$ psql --cluster 11/fabmnet -h localhost > > Password for user postgres: > > psql: FATAL:  password authentication failed for user "postgres" > > FATAL:  password authentication failed for user "postgres" > > Did you set a password for the postgres user in that newly created > cluster? > If not, try psql --cluster 11/fabmnet (without -h localhost), > it should connect you without a password, > then set a password with the \password command in psql, > then try again with -h localhost. > > > Best regards, > -- > Daniel Vérité > PostgreSQL-powered mailer: http://www.manitou-mail.org > Twitter: @DanielVerite > -- Adrian Klaver adrian.klaver@aklaver.com