postgres creating new user/role

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

provided name and choosen superuser

then:

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

UPDATE:

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

sudo useradd -d /home/dogspot -m dogspot
sudo passwd dogspot

1 Answer

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.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like