Opened 10 years ago

Closed 6 years ago

#2359 closed enhancement (wontfix)

osm2pgsql should accept a password as an argument

Reported by: aubreyholland@… Owned by: jburgess777@…
Priority: major Milestone:
Component: osm2pgsql Version:
Keywords: osm2pgsql password Cc:

Description

osm2pgsql takes arguments for all of the necessary information to connect to the database except for the password. Because the only option it provides for the password is for it to produce a prompt, this means that osm2pgsql can't be called through scripts, cron jobs, etc. without human intervention in cases where a password is required. There are other options for providing the password (the pgpass file, for example), but none of them seem as clean as simply providing the password to the program as other apps like osmosis allow.

I am attaching a diff that adds this feature. It changes the --password (-W) argument to take a password as a parameter and adds another argument, --prompt (-x) that does what --password used to do. I wasn't thrilled about changing the usage of the existing argument, but that seems like what --password really *should* do.

Attachments (1)

osm2pgsql.diff (2.4 KB) - added by aubreyholland@… 10 years ago.
A diff that adds the requested functionality

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by aubreyholland@…

Attachment: osm2pgsql.diff added

A diff that adds the requested functionality

comment:1 Changed 10 years ago by Tom Hughes

Owner: changed from Tom Hughes to jburgess777@…

The current form of -W is deliberate - it mirrors all the postgresql tools I believe.

Not allowing passwords on the command line is a security feature as it stops other users being able to see them in process listings.

comment:2 Changed 10 years ago by jburgess777@…

I have to agree with Tom. The current choice was to deliberately match 'psql' and similar postgresql tools. If you need things to run from cron etc on localhost then I would recommend using ident authentication which is arguably even more secure than using a password.

comment:3 Changed 8 years ago by Tom Hughes

Component: utilsosm2pgsql

comment:4 Changed 6 years ago by amm

Resolution: wontfix
Status: newclosed

I would second TomH and jburgess, so I am closing this ticket as won't fix. There also hasn't been any activity on this ticket for the last 4 years.

Note: See TracTickets for help on using tickets.