Code Comments
Programming Forum and web based access to our favorite programming groups.I would like to impersonate a user. For example if I want to being "nobody" I was thinking I could use getpwnam(3) to retrieve the associated uid and gid with which I would call setuid and setgid respectively. Is this a secure procedure? What other state in a process is user specific? Locales? Thanks, Mike
Post Follow-up to this messageMichael B Allen <mba2000@ioplex.com> wrote: > I would like to impersonate a user. For example if I want to being > "nobody" I was thinking I could use getpwnam(3) to retrieve the > associated uid and gid with which I would call setuid and setgid > respectively. Is this a secure procedure? What other state in a process > is user specific? Use following steps: getpwnam -> setgid -> setgroups -> setuid. In setgroups() set zero item to GID of the user.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.