2

I try to run pgadmin3 as user postgres and I get following error:

No protocol specified
Error: Unable to initialize gtk, is DISPLAY set properly?

Command pgadmin3 runs well under pavel (my main user account).

The answers of a question on this suggested either some server connection magic (not my case - I try to run it on localhost), or setting DISPLAY variable. I checked it through printenv both under pavel and postgres, and it's :0 for both. I used the trick to find which processes have DISPLAY variable set under both users. For pavel, there's very long list with the DISPLAY values :0 (for most processes, including pgadmin) or :0.0 (for some). But for postgres, there are just three or four processes in the list.

Here's where I'm stuck: how to set an environment variable (DISPLAY, in this case) for a process? Or better, for application/user combination, so that the process would see the DISPLAY setting from the very start. I already tried to hardcode DISPLAY in ETC/ENVIRONMENT, but nothing changed - it affects the DISPLAY value where it is set (for users and processes), but not its visibility for processes run by the users.

  • Does this work for you? env DISPLAY=:0 pgadmin3 – MadMike Oct 30 '14 at 8:11
  • @MadMike: no, still the same error. – Pavel V. Oct 30 '14 at 8:37
  • Maybe this answer works for you? askubuntu.com/a/28572/75166 – MadMike Oct 30 '14 at 8:40
  • @MadMike: No protocol specified. xhost: unable to open ":0" - so no luck. I will try to search more and focus on the "no protocol specified" part - this wasn't included in the questions/answers I already inspected. – Pavel V. Oct 30 '14 at 8:47
3

It sounds like you sudo'd to the postgres user then tried to run Pgadmin from there.

Don't do that.

Run PgAdmin as your regular user, without sudo. You might need to create yourself a user account on the DB and/or edit pg_hba.conf to allow connections first, but once that's done you can use PgAdmin.

  • I've read somewhere that it's not recommended to assign postgres (superuser) a password under Linux, from security reasons. Was this a good advice, or not? If it was, then how to use pgadmin as postgres? Creating another superuser account with password? – Pavel V. Oct 30 '14 at 15:56
  • 1
    @PavelV. I think that's a bit silly, personally. There's little meaningful difference between peer over a unix socket and using md5 on connections restricted to localhost; if anything it's stronger since you need the password not just the correct login account. But you can use peer if you want; just add a pg_ident.conf entry allowing your username to log in as the postgres superuser. Personally: I'd just set a password on user postgres and tweak pg_hba.conf to allow md5 logins. (Then again, I don't use PgAdmin so none of this applies to me normally). – Craig Ringer Oct 30 '14 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.