Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f73ju-0006O4-AR for pgsql-general@arkaria.postgresql.org; Fri, 13 Apr 2018 18:48:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f73jt-0002sy-9J for pgsql-general@arkaria.postgresql.org; Fri, 13 Apr 2018 18:48:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f73js-0002sp-RV for pgsql-general@lists.postgresql.org; Fri, 13 Apr 2018 18:48:01 +0000 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f73jq-0006ih-2m for pgsql-general@lists.postgresql.org; Fri, 13 Apr 2018 18:47:59 +0000 Received: by mail-pl0-x244.google.com with SMTP id w12-v6so5644323plp.0 for ; Fri, 13 Apr 2018 11:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=gOTiqDM8KVvCiWSMwuExesVHMb0o2p4yObCJkEdGqp8=; b=IVTi+KZ688d1N36or250Twsfkc5i8kx37VAX/20truPyE51VEeF6PLFjHX4qSMKHe8 4MoktbrIvxRc684XQV7H8H74Mmgj6dihnKARmJc6ZvH6P5WLmyVRE7ppWKKI3u26gb36 YXdvOTfI4Q6iJ67aTKcXQcHeVPfxfeojOK0zFsHP+DYouFOTzzq6nmCaO25lzymjl9JP daGEVPUcGS47j5gEStm2KCQAkL/S4fIrm0xSv+JRPkIAnpcHDS7qHWqm6YEqE2cayhFO Ry7HaBaSi8cwwuhJ8sL/WdLRPPC35vxC6cd1FRq9JUc8a5a9LJ8SGmpLm47gvgM00ZsF v5RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=gOTiqDM8KVvCiWSMwuExesVHMb0o2p4yObCJkEdGqp8=; b=jVCKR5Pip31TNiu8+rPLLT/7WjpsYoq50u4O2IfHLdXtbIeOYpHVBiKGZaQHhUmNbg ria9I1WT5p0+LMawS8zvki5GxKRVFT0HfBn8isk3VrJ23PsDJIJ5peAZs0PmioF0G8DQ PFoPOV0GsraodP+YcOZGQvLZTro5Bxtq7e5SQEVxIp43kSKKuut9p7UkNnSRLdzIqfAq zPo8dfYe27PPDtUGnkaCyZye9iHvV87H0AGMY+3qtrBtS9J3kQk8C0EmqLo+hezzdcMm 1kl9VRRCm1JGSh+s/fVAAn5BxqnOHx2NWXBW9hrdFScbMumOWZR9oEDlMIu5KKvs6KIg uaBQ== X-Gm-Message-State: ALQs6tCZongSD3O2szMcIOhY1lQpajifGTDAHNz8lkuZLJ9Z7Kw73wyO ih8kVX7J85e/WR3GrojDwmBYrxdf X-Google-Smtp-Source: AIpwx48r82TDP0/Ti4Vci8gvsn/b6OoYrEvOW9UXYYfgMmMSjQGkE4K51HG4nIjj7zOr3XZ8vAKvKw== X-Received: by 2002:a17:902:2cc1:: with SMTP id n59-v6mr207961plb.198.1523645276564; Fri, 13 Apr 2018 11:47:56 -0700 (PDT) Received: from [10.104.134.14] ([155.100.47.6]) by smtp.gmail.com with ESMTPSA id q62sm18830647pfd.61.2018.04.13.11.47.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Apr 2018 11:47:56 -0700 (PDT) Subject: Re: hardcode password in connect string To: pgsql-general@lists.postgresql.org References: From: Rob Sargent Message-ID: Date: Fri, 13 Apr 2018 12:47:55 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------E1BCDFA1B2676D9D26851F42" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------E1BCDFA1B2676D9D26851F42 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 04/13/2018 12:46 PM, James Keener wrote: > Is setting it as an environment variable an option? > https://www.postgresql.org/docs/9.1/static/libpq-envars.html > > Alternatively, a service file? > https://www.postgresql.org/docs/9.0/static/libpq-pgservice.html > > Jim > > On April 13, 2018 2:43:01 PM EDT, David Gauthier > wrote: > > Hi: > > PG v9.5.2 on RHEL > > I like to use an alias to connect to my favorite DBs but don't > like to enter passwords.  I used to just disable passwords > (working behind a firewall), but this one is different.  I see > nothing in the interactive connect string where I can enter the > password... > > psql -h thehost -U memyselfi mydb > > Missing something like "-p mypassword" > > Is there a way I can stick the pw in the linux alias definition ? > > Just thinking something like this may be available since hardcoded > passwords are supported in perl/dbi, pg driver > > Thanks ! > > > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. This is usually done in ~/.pgpass --------------E1BCDFA1B2676D9D26851F42 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 04/13/2018 12:46 PM, James Keener wrote:
Is setting it as an environment variable an option? https://www.postgresql.org/docs/9.1/static/libpq-envars.html

Alternatively, a service file? https://www.postgresql.org/docs/9.0/static/libpq-pgservice.html

Jim

On April 13, 2018 2:43:01 PM EDT, David Gauthier <davegauthierpg@gmail.com> wrote:
Hi:

PG v9.5.2 on RHEL

I like to use an alias to connect to my favorite DBs but don't like to enter passwords.  I used to just disable passwords (working behind a firewall), but this one is different.  I see nothing in the interactive connect string where I can enter the password...

psql -h thehost -U memyselfi mydb

Missing something like "-p mypassword"

Is there a way I can stick the pw in the linux alias definition ?

Just thinking something like this may be available since hardcoded passwords are supported in perl/dbi, pg driver

Thanks !

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
This is usually done in ~/.pgpass
--------------E1BCDFA1B2676D9D26851F42--