I am following this tutorial, and being logged in as postgres I run: createuser --interactive

provided name and choosen superuser


createdb dogspot

but when trying

sudo -i -u dogspot

I get:

postgres@ip-172-31-12-126:/home/ubuntu$ sudo -i -u dogspot
sudo: unknown user: dogspot
sudo: unable to initialize policy plugin

but the user exists for sure, because when trying to once more creatuser there is prompt about already existing one. Some hints how to do it correctly will be apriciated.

db version:

psql (PostgreSQL) 9.3.4

os version:

Ubuntu 14.04 LTS


seems that all was needed wat to creat linux user before with coresponding name:

sudo useradd -d /home/dogspot -m dogspot

sudo passwd dogspot

You are confusing PostgreSQL users and operating system users.

A PostgreSQL user may exist without a corresponding operating system user.

By default, connections use peer authentication, where you must be running as the OS user with the same name as the PostgreSQL user you try to connect to. You can change that in pg_hba.conf though, for all users or just for some users/DBs. For more detail see the client authentication chapter.


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.