osm2pgsql: Permission denied

Hi guys

I’m trying to install Nominatim but I keep getting stuck when I try to import my osm file into the postgreSQL server.

sudo ./utils/setup.php --osm-file /path/to/planet.osm  --all

I always end up with the exact same error and I cannot for the life of me figure out why. Bear in mind that I haven’t used Linux in about 8 years, and quite frankly the only reason that I’m not trying to install OSM on a Windows machine is because I cannot find any tutorials online.

After I run the command it creates a few tables, does a few inserts and then after about 30 seconds it gives me:

SET
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
Import
sh: 1: /home/wezzjm/osm2pgsql: Permission denied
ERROR: DB ERROR: no such table
DB Error: no such table

Now I’ve tried installing osm2pgsql from the Software Center as well in which case osm2pgsql seems to end up in “/usr/share/osm2pgsql” but even when I change my local.php file to point there I still get the same error.

I’ve tried running:

sudo su

Which I always assumed gives you full permission for everything - As in I could sleep with your wife as long as I first run “sudo su”.
Then:

sudo ./utils/setup.php --osm-file /path/to/planet.osm  --all

But I still get the same problem. Also all the users in the postgreSQL server are superusers apart from www-data.

I guess I should mention that I’m using:
UBUNTU 12.1 LTS
postgreSQL 9.1
and whatever the latest version of osm2pgsql is

If you guys need anymore info from me just let me know although I’ve gone through every single step at:
http://wiki.openstreetmap.org/wiki/Nominatim/Installation
as well as
http://jaspreetchahal.org/setting-up-your-own-openstreetmap-server/

I appreaciate any help.

same problem as wezzjm mentioned.

This is a database issue, so sudo is the wrong way. The database has its own ACL.

I had the same issue. This worked for me:

  • I changed the osm2pgsql path in settings/local.php from /usr/share/osm2pgsql to /usr/bin/osm2pgsql

So you need to set the osm2pqsql path to your osm2pqsql binary.

Hope this helps.