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 pluginbut 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.4os version:
Ubuntu 14.04 LTSUPDATE:
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.