Re: Change from one user to another in program.
From: Barry Margolin (barry.margolin_at_level3.com)
Date: 05/30/03
- Previous message: Fletcher Glenn: "Change from one user to another in program."
- In reply to: Fletcher Glenn: "Change from one user to another in program."
- Next in thread: Greg Ennis: "Re: Change from one user to another in program."
- Reply: Greg Ennis: "Re: Change from one user to another in program."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 29 May 2003 22:28:35 GMT
In article <3ED6872A.1CE339B0@quest.com>,
Fletcher Glenn <f-g-l-e-n-n@quest.com> wrote:
>It's laughably easy for the root user to change its
>user ID from within a program. This of course is not
>true for an ordinary user. Given that I have the username
>and password for the target identity, how do I use this
>information to execute as this target user from within
>a program.
>
>I've tried a number of approaches, from fork/exec()ing su
>to opening a pty. Every approach I take runs into a
>snag where all of the authentication API's require that
>submission of the password come from a genuine terminal,
>or a child of a direct login. Does anyone have a method
>that actually works from a daemon program (not running
>as root)? The method needs to work even if the
>target user is root, which rules out the idea of a
>loopback rlogin. Not every system will allow a non-console
>login from root.
Running su through a pty should work -- a pty is considered a "genuine
terminal" (if it weren't, you wouldn't be able to use su in an xterm or
remote login session).
-- Barry Margolin, barry.margolin@level3.com Level(3), Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
- Previous message: Fletcher Glenn: "Change from one user to another in program."
- In reply to: Fletcher Glenn: "Change from one user to another in program."
- Next in thread: Greg Ennis: "Re: Change from one user to another in program."
- Reply: Greg Ennis: "Re: Change from one user to another in program."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|