Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to program changing user name in c program for linux?

2 views
Skip to first unread message

Dennis Nguyen

unread,
Mar 3, 2003, 12:03:52 PM3/3/03
to
Hello all,

I was running my program under "root" user and
I wanted to access postgresql in the program
which required "postgres" user. (start program
under "root" then change to "postgres" user momentary)

How can I set user to "postgres" in the c program?
I found seteuid(id) and setreuid(id, id) functions.
But I have to know postgres's id before hand in order
to use these functions.

Is there any function in c program can be used
to set effective user's name instead of user's id?

Thank you,
Dennis

Jamie Stallwood

unread,
Mar 3, 2003, 2:09:50 PM3/3/03
to
On 03 Mar 2003 17:03:52 GMT, Dennis Nguyen <denni...@msn.com> wrote
in linux.redhat.development:

>Is there any function in c program can be used
>to set effective user's name instead of user's id?
>
>Thank you,
>Dennis

man getpwnam and getgrnam

0 new messages