Frage

enter image description here

I'm using emacs on a console (emacs -nw). I use sql-mode, and when connecting to postgresql, it asks me to enter a password on a buffer, where password is visible.

If I customize-group and set the password option in sql-postgre-login-params list, it asks for password on the minibuffer, but also asks for password on a buffer.

How can customize sql-mode to get asked for password only on the minibuffer?

Thanks in advance.

Edit: the Emacs version: GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)

War es hilfreich?

Lösung 2

Found a temporary solution to this problem.

According to psql man page:

-W, --password
Force psql to prompt for a password before connecting to a database. This option is never essential, since psql will automatically prompt for a password if the server demands password authentication. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.

So, connecting to postgres database through psql when a connection needs a password will ever prompt for a password in a buffer.

A temporary solution might be set the -w option on psql call to not ask for a password. Then, it gets the password from the ~/.pgpass file. This file has 0600 permissions so it is insecure. But works for me right now.

In the .emacs file:

(custom-set-variables
        '(sql-postgres-options (quote ("-P" "pager=off" "-w"))))

A better solution might be using ssl certificates, which I will explore.

Thank you all for your help.

Andere Tipps

What emacs version are you using? This happened to me when I used emacs23, if that's the case, you have several options.

  • Update to emacs 24. It hides passwords automatically.

  • If this happens once or twice, you could use M-x send-invisible (RET) password (RET)

  • If this happens a lot, try:

    (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top