get effective and real user-ids in a setuid program in linux

Discussion in 'C Programming' started by vimala, Jul 31, 2003.

  1. vimala

    vimala Guest

    Hi,
    I have to write a setuid program which is going to check for
    accesslogs based on the real user who had invoked the executable.

    I need to get the real and effective user-ids of the system
    and based on the real user-id i need to filter logs only for that
    user and give it for further activity. My idea was to get the real
    userid, groupid and search for a pattern x:userid:groupid in the
    /etc/password file. But again that involves fork, exec, write the
    result to some file etc.....

    Instead of doing all that is there any other way of getting
    all this done???

    -kellogy
    vimala, Jul 31, 2003
    #1
    1. Advertising

  2. vimala

    Jack Klein Guest

    On 31 Jul 2003 04:28:00 -0700, (vimala) wrote in
    comp.lang.c:

    > Hi,
    > I have to write a setuid program which is going to check for
    > accesslogs based on the real user who had invoked the executable.


    [snip]

    Linux user ID's and setuid are part of Linux, not defined or supported
    by standard C. Undoubtedly your compiler provides access to OS
    provided mechanisms to do these things, but since they're not part of
    the standard language their are not discussed here.

    Try a group like news:comp.os.linux.development.apps for Linux
    specific questions.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c /faq
    Jack Klein, Aug 1, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    694
    Beat Bolli
    Jun 21, 2005
  2. Ethan Furman

    Python, Linux, and the setuid bit

    Ethan Furman, Apr 14, 2014, in forum: Python
    Replies:
    8
    Views:
    46
    Chris Angelico
    Apr 15, 2014
  3. Chris Angelico

    Re: Python, Linux, and the setuid bit

    Chris Angelico, Apr 15, 2014, in forum: Python
    Replies:
    0
    Views:
    46
    Chris Angelico
    Apr 15, 2014
  4. Dave Angel

    Re:Python, Linux, and the setuid bit

    Dave Angel, Apr 15, 2014, in forum: Python
    Replies:
    1
    Views:
    56
    Grant Edwards
    Apr 15, 2014
  5. Ethan Furman

    Re: Python, Linux, and the setuid bit

    Ethan Furman, Apr 15, 2014, in forum: Python
    Replies:
    0
    Views:
    45
    Ethan Furman
    Apr 15, 2014
Loading...

Share This Page