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 1iXufU-0001t6-5o for pgsql-general@arkaria.postgresql.org; Thu, 21 Nov 2019 22:11:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iXufS-0008Av-Mo for pgsql-general@arkaria.postgresql.org; Thu, 21 Nov 2019 22:11:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXufS-00088H-7L for pgsql-general@lists.postgresql.org; Thu, 21 Nov 2019 22:11:14 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iXufP-0007tJ-Nt for pgsql-general@lists.postgresql.org; Thu, 21 Nov 2019 22:11:13 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E518322C12; Thu, 21 Nov 2019 17:11:10 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 21 Nov 2019 17:11:10 -0500 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=n 6F4+pYsyRSr5C7b4W13T/olj44RQeBelKWoIlXS6CU=; b=S1fZ5ICnVEM+Wlaqb J3JXMeZFWz0LT5WkJMB7KOADF2qsrqbKHyDCdkOaaYj6bPnyOWVbzCgTuQDEcxDw N50q8n6JZTij9R7+dnXUWTZOcoWEQJ0Fq8G0q9TTv8hzYa9gIJTpC1t6z9CUk5nJ aG2g9ftxO08fNKuupWPtYyntuXEcM1FoXgiHUiRkmZ13iGUzzBs+1hRePdfkMPcy uH6Tl4pFJkYZhJTGzjKTFjo68lpJLUg2FNXN0DJj5XrvKsAwgGDxQkpRQw5G+8Uz 7v1ffhlNwH6fg6M4yfcniU0FJ5DVh8PoISdnZiiqsqbmwoqSw8qqqgp6hoamfRW7 3JSaA== 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=fm1; bh=n6F4+pYsyRSr5C7b4W13T/olj44RQeBelKWoIlXS6 CU=; b=azzw0sUnQjP13/7hHgAXZdnkLuupquqgcNQ7dHnmgzCi2ggXlems4g72r zd40x4A3tHDO56tlzTHF/CHbOrKqikqQHQax63T4KLL7gvc5bwjkLLBNUaXDcOO4 HCrUaIBADvB7DaQvH32NfpyO8Ftet7Jis7nYt+2466z3iZarIIc9WoSdQCiR5Uwo NKMmoMjfBhYHyWijV+/9PvIW9vBDicc4QUUzjVL3TCkBhsvNH1CQbgc7iNw7DRLQ pwXaF/0kKBc6Z/J1Ot80PTg8+H+j+UPmdHnflTiSLoma20s/mBKWDgidUVQ9kxqu dpn8/MeuF51JxGGBpM59FAK5+lzxQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudehvddgudehlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesth ejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvg hsqhhlrdhorhhgnecukfhppeejfedrvdefledruddujedrvdefkeenucfrrghrrghmpehm rghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenuc evlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id DF7FB80060; Thu, 21 Nov 2019 17:11:09 -0500 (EST) Subject: Re: Help with authentication on Debain/Ubuntu installation To: stan Cc: pgsql-general@lists.postgresql.org References: <20191121124517.GA3320@panix.com> <20191121141502.GA14731@panix.com> <20191121143539.GA18839@panix.com> <20191121161247.GE21704@panix.com> <20191121190927.GA21941@panix.com> <20191121215226.GA11603@panix.com> From: Adrian Klaver Message-ID: <76a1827a-b05c-a170-aace-2c07daf7ac32@aklaver.com> Date: Thu, 21 Nov 2019 14:11:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <20191121215226.GA11603@panix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/21/19 1:52 PM, stan wrote: > > On Thu, Nov 21, 2019 at 12:14:16PM -0800, Adrian Klaver wrote: >> 5) Now in your case you have peer auth(first in the list) for local socket >> connections which means a user can only connect on the local socket as the >> db postgres user if they are also the os postgres user. >> You can work around that by having other users connect to the database using >> a -h(host) connection that requires a password. > I will answer your questions below, but I would suggest you spend some time going over: https://www.postgresql.org/docs/11/auth-pg-hba-conf.html It will answer a lot of questions. > So, to implement it this way. I would > > * set teh postgres database user password to one I know. > * run tasks that need posgres superuser access with -h > -U postgress -W > > * enter the password. > > Correct? Yes and no. If you are running tasks as the OS user postgres and connecting to the local socket(no -h) then this: # Database administrative login by Unix domain socket local all postgres peer will apply and you will not need a password. If you are not running as the OS user postgres or are not using the local socket, then another connection line in pg_hba.conf will come into play. In that case you probably want something like: host all postgres md5 In the above case you can connect as an OS user other then postgres(using -U postgres) and you will be need to supply a password. Also if you connect as OS user postgres(using -h) then you will a password. The password can be supplied manually or it can come from .pgpass: https://www.postgresql.org/docs/11/libpq-pgpass.html or an env variable: https://www.postgresql.org/docs/11/libpq-envars.html > > I should have thought of this technique, I have used it in the past when I > had issues with pg_hba.conf file. Something abou IPV6 entries, or lack of > them ? Possibly, you can force a IPV4 connection by doing for instance: -h 127.0.0.1 instead of -h localhost in the case where localhost is pointing to ::1 > > Thanks for the help. > -- Adrian Klaver adrian.klaver@aklaver.com