[sudo-users] How to do 'su' programatically?

Alex Chen alex_chen at filemaker.com
Fri May 8 21:48:10 EDT 2009


We want to be able to let our application, running with user ABC's  
privilege to execute a program/script in user XYZ privilege with that  
user's password.
We are able to do this with the following settings in sudoers file, i.e.

Defaults: ABC	targetpw, timestamp_timeout=0, passwd_tries=1
ABC localhost=(ALL)		ALL

This approach works but it requires the end user to fiddle around with  
sudoers.

We are thinking about doing something like 'su XYZ', which requires  
the password and we need to feed it,  and then do 'exec'.
Can anyone point me to the necessary Unix API to achieve these steps?

Any help is appreciated.

Alex








More information about the sudo-users mailing list