[sudo-users] Possible to alter outcome of getlogin() ?

Chris Irvine chrisi at darkhorse.com
Sat Oct 16 01:23:41 EDT 2004

I'm wanting to simulate another user using sudo. (something I do all 
the time for root.)

It seems to me like calling `sudo -u someuser a_command` should run the 
command as someuser.

Instead, what happens is that the command still behaves as if I was 
running it myself. I dug up the source for the tool and found it is 
calling getlogin() from unistd.h. So the question I guess, "Is there a 
way that I can get sudo to setlogin() ?"

(Ultimately, I'm trying to trying to let my apache user www, run a 
command as someuser. I'm running this on OS X which currently uses sudo 

More information about the sudo-users mailing list