2

The goal is to let the www-data user execute sudo -u postgres -H osm2pgsql [some options here] without being asked for a password (as this will be part of a script wich runs automatically).

I thought I could do it with the following line in sudoers file

www-data ALL=NOPASSWD: /usr/bin/sudo -u postgres -H osm2pgsql *

But this does not seem to work. What am I doing wrong?

2 Answers 2

4

The syntax you need is

Defaults:www-data !requiretty
www-data ALL=(postgres) NOPASSWD: /usr/bin/osm2pgsql

where /usr/bin/osm2pgsql should be replaced by the actual path of osm2pgsql. The !requiretty line allows the sudo from a script without a terminal. This allows the command sudo -u postgres -H osm2pgsql with any options to work.

0

Try:

www-data ALL=NOPASSWD: /path/to/osm2pgsql

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.