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)
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.