No Passwd Entry for User 'Postgres' Error

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?

2 Answers

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.