zan
zan

Reputation: 594

No passwd entry for user 'postgres' error

I'm trying to setup Postgres on Ubuntu 14.04 without success. After running

sudo apt-get install libpq-dev python-dev

and

sudo apt-get install postgresql postgresql-contrib

I've managed to install the packages successfully. However upon executing sudo su - postgres, I'm receiving the following error:

No passwd entry for user 'postgres'

It seems like the installation did not create the user postgres as it is not in the /etc/passwd file. Reinstalling the package does not resolve the issue. How can I add the required postgres user?

Upvotes: 20

Views: 48411

Answers (2)

zan
zan

Reputation: 594

I've solved the issue by purging and re-installing the packages, i.e.

sudo apt-get --purge remove postgresql*

sudo apt-get install postgresql postgresql-contrib

Upvotes: 12

Craig Ringer
Craig Ringer

Reputation: 325141

It sounds like you want the PostgreSQL server:

apt-get install postgresql-server

Also, you never need to use sudo su - postgres. Just:

sudo -u postgres -i

to get an interactive shell, or

sudo -u postgres psql

(or whatever) to run a command.

Upvotes: 22

Related Questions