Enable user to execute one command as another user

Matthias

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?

meuh

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Execute a command on user logon

From Dev

Execute as another user that is not root

From Dev

ssh change user and execute command

From Dev

Execute command if su to a certain user

From Dev

Discord Python Allow one user to identify another within command

From Dev

Execute a command if another one was succesfull?

From Dev

How can I execute a script as root, execute some commands in it as a specific user and just one command as root

From Dev

executing history command as another user

From Dev

scripting a write command to another user

From Dev

Paypal transfer one user to another user

From Dev

Execute command into Kubernetes pod as other user

From Dev

MongoDB 3.2 - Admin user not authorized to execute command

From Dev

How to execute a command on behalf of a user if login is denied

From Dev

Mysql Procedure Error (execute command denied to user)

From Dev

Execute net user command from C#

From Dev

Update role user: not authorized on admin to execute command

From Dev

How to execute a command on behalf of a user if login is denied

From Dev

Linux switch user and execute command immediately

From Dev

How to execute command before user login on linux

From Dev

execute user input as shell command in C

From Dev

Calling another user command inside the user defined command

From Java

How to execute a group of commands as another user in Bash?

From Dev

Execute query to linked server as another user

From Dev

Import scripts and execute the one the user needs

From Dev

Is it possible to execute a script that takes user input then execute another script

From Dev

su options - running command as another user

From Dev

Pass arguments to a command run by another user

From Dev

How to view command history of another user in Linux?

From Dev

Having trouble running a command as another user on Ubuntu

Related Related

  1. 1

    Execute a command on user logon

  2. 2

    Execute as another user that is not root

  3. 3

    ssh change user and execute command

  4. 4

    Execute command if su to a certain user

  5. 5

    Discord Python Allow one user to identify another within command

  6. 6

    Execute a command if another one was succesfull?

  7. 7

    How can I execute a script as root, execute some commands in it as a specific user and just one command as root

  8. 8

    executing history command as another user

  9. 9

    scripting a write command to another user

  10. 10

    Paypal transfer one user to another user

  11. 11

    Execute command into Kubernetes pod as other user

  12. 12

    MongoDB 3.2 - Admin user not authorized to execute command

  13. 13

    How to execute a command on behalf of a user if login is denied

  14. 14

    Mysql Procedure Error (execute command denied to user)

  15. 15

    Execute net user command from C#

  16. 16

    Update role user: not authorized on admin to execute command

  17. 17

    How to execute a command on behalf of a user if login is denied

  18. 18

    Linux switch user and execute command immediately

  19. 19

    How to execute command before user login on linux

  20. 20

    execute user input as shell command in C

  21. 21

    Calling another user command inside the user defined command

  22. 22

    How to execute a group of commands as another user in Bash?

  23. 23

    Execute query to linked server as another user

  24. 24

    Import scripts and execute the one the user needs

  25. 25

    Is it possible to execute a script that takes user input then execute another script

  26. 26

    su options - running command as another user

  27. 27

    Pass arguments to a command run by another user

  28. 28

    How to view command history of another user in Linux?

  29. 29

    Having trouble running a command as another user on Ubuntu

HotTag

Archive