This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Populating database on Rails Port using osmosis authentication failure

0

Hi, I've been following the instruction on the github page for installing the Rails Port, and have successfully completed all of those instructions. I am now trying to populate the database following the instructions here. I've tried running the osmosis command:

osmosis --read-pbf [my-osm-file].osm.pbf --write-apidb host="localhost" database="openstreetmap" user="openstreetmap" password="" validateSchemaVersion="no"

However, it initially gives me an error that argument 7 (password) doesn't contain a value after the '=', so I removed that field. Now it is giving me a password authentication failed error for user "openstreetmap".

I tried manually logging into the openstreetmap database by running the following command:

psql -d openstreetmap -U openstreetmap

and I get this error:

psql: FATAL: Peer authentication failed for user "openstreetmap"

Running the same command but with my own username allows me to log into the database. So then I tried the osmosis command with the username replaced with mine, but it still gives me a password authentication failure error. I'm stuck now as to what to try next. Any suggestions would be very much appreciated.

asked 21 Dec '16, 15:05

AndrewPalmer's gravatar image

AndrewPalmer
16112
accept rate: 0%


One Answer:

2

Try

sudo -u postgres psql -c "alter role openstreetmap with password 'openstreetmap'"

and then specify "openstreetmap" as a password in your osmosis command line. You will then also be able to do

psql -W -d openstreetmap -U openstreetmap

and log in to the database with the password. (Logging in without password, as you tried above, would require "trust" authentication configured in pg_hba.conf or a special configuration of the "peer" authentication method to allow your Unix user to connect as PostgreSQL user "openstreetmap".)

answered 21 Dec '16, 16:19

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

edited 21 Dec '16, 16:19

1

Thanks, adding the password worked.

(22 Dec '16, 10:06) AndrewPalmer

Source code available on GitHub .