From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: sql-postgresql authentication failure Date: Fri, 25 May 2007 15:28:56 +1000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87k5ux5v53.fsf@lion.rapttech.com.au> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1180071703 5566 80.91.229.12 (25 May 2007 05:41:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 May 2007 05:41:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 25 07:41:42 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HrSYS-0005fw-69 for geh-help-gnu-emacs@m.gmane.org; Fri, 25 May 2007 07:41:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HrSYR-0004y8-Mm for geh-help-gnu-emacs@m.gmane.org; Fri, 25 May 2007 01:41:35 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!sn-xt-sjc-03!sn-xt-sjc-06!sn-xt-sjc-01!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:795fg7yTpFV+lA5/i4Hoi70623w= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 85 Original-Xref: shelby.stanford.edu gnu.emacs.help:148824 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:44416 Archived-At: "Sebastian P. Luque" writes: > Subject: sql-postgresql authentication failure > > Hi, > > I'd like to use `sql.el' to connect to local postgresql databases. I'm > accessing the server through my normal user account, although I've added > myself as a super user in the postgresql server. In a shell, I can > connect to a 'test' database with: > > ---<---------------cut here---------------start-------------->--- > $ psql test > Welcome to psql 8.2.4, the PostgreSQL interactive terminal. > > Type: \copyright for distribution terms > \h for help with SQL commands > \? for help with psql commands > \g or terminate with semicolon to execute query > \q to quit > > test=# > ---<---------------cut here---------------end---------------->--- > > However, when I try to do it from Emacs with `sql.el', I have: > > > M-x sql-postgresql > > In the minibuffer: > > "User: myuser" > "Database: test" > "Server: localhost" > "Password for user myuser: secret" > > and the message from the server: > Password for user myuser: > psql: FATAL: password authentication failed for user "myuser" > > Process SQL exited abnormally with code 2 > > Password for user sluque: > psql: FATAL: password authentication failed for user "myuser" > > Process SQL exited abnormally with code 2 > > > I'm using: > > ,-----[ psql --version ] > | psql (PostgreSQL) 8.2.4 > | contains support for command-line editing > `----- > Yep, I think so. Later versions of postgres are often installed with support for local authentication only and disable network authentication. From memory, you can configure postgres to use either username/password authentication for both local and network based access or you can have it configured to use identd based checking for local connections - essentially its assuming that if local user x is trying to connect from local account x, and x is permitted to access the database, then let them through without th need for passwords. There are two possible ways of fixing this. The first solution will almost definitely work. Change the authentication scheme used by postgres for the databases you want to use to be user/password based. This is outlined in the postgres documentation. the second method may work and is easier, but no guarantee. It is possible that if you set specific switches, the psql client that sql mode uses will use local non-password based authentication. While sql-mode will still prompt you for the username/password, this information will be ignored by the psql client and you will get authenticated.based on the user that is running the psql client (i.e. you). Personally, although the local authentication is convenient, I don't like it. If your account is compromised, so are your databases. Then again, some would argue that if your account is compromised, you have bigger problems anyway. Tim -- tcross (at) rapttech dot com dot au