Re: Change from one user to another in program.

From: Andrew Gierth (andrew_at_erlenstar.demon.co.uk)
Date: 05/31/03


Date: 31 May 2003 05:18:55 +0100


>>>>> "Fletcher" == Fletcher Glenn <f-g-l-e-n-n@quest.com> writes:

 Fletcher> It's laughably easy for the root user to change its user ID
 Fletcher> from within a program. This of course is not true for an
 Fletcher> ordinary user. Given that I have the username and password
 Fletcher> for the target identity, how do I use this information to
 Fletcher> execute as this target user from within a program.

 Fletcher> I've tried a number of approaches, from fork/exec()ing su
 Fletcher> to opening a pty. Every approach I take runs into a snag
 Fletcher> where all of the authentication API's require that
 Fletcher> submission of the password come from a genuine terminal, or
 Fletcher> a child of a direct login. Does anyone have a method that
 Fletcher> actually works from a daemon program (not running as root)?
 Fletcher> The method needs to work even if the target user is root,
 Fletcher> which rules out the idea of a loopback rlogin. Not every
 Fletcher> system will allow a non-console login from root.

your design is wrong. Passwords are for users to give to the system,
not for programs to give to other programs.

-- 
Andrew.
comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>


Relevant Pages

  • Re: Change from one user to another in program.
    ... Andrew Gierth wrote: ... > Fletcher> It's laughably easy for the root user to change its user ID ... > Fletcher> execute as this target user from within a program. ...
    (comp.unix.programmer)
  • Change from one user to another in program.
    ... It's laughably easy for the root user to change its ... information to execute as this target user from within ... or a child of a direct login. ... The method needs to work even if the ...
    (comp.unix.programmer)