1

Possible Duplicate:
Running command-line application from PHP as specific user

I've got a script that I need to run from a PHP script, and it needs to be run as a specific user. It isn't a problem of permissions, it's that it runs 'screen' which needs to be accessible from the specified user.

I've tried using exec and sudo, however sudo asks for the password of www-data. Since I am not prompting for the password for www-data, instead for the specified user, this will not work.

Anyone know if this is possible?

Community
  • 1
  • 1
Eli
  • 636
  • 2
  • 7
  • 17
  • 4
    There is the `/etc/sudoers` file, which allows to setup password-less authorization for specific commands. – mario Oct 22 '11 at 18:24
  • 1
    I'm not looking to set up password-less sudo. I want to be able to have it run a command as a specific user with the specified username and password. – Eli Oct 22 '11 at 19:15
  • @Eli: `$ man sudo` - and if you don't have a shell at hand: http://linux.die.net/man/8/sudo – hakre Oct 22 '11 at 21:13

1 Answers1

1

OK, I figured it out. One has to add the option:

Defaults        targetpw

to the sudoers file, and it will ask for the target user's password.

Eli
  • 636
  • 2
  • 7
  • 17