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

V

vimala

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
 
J

Jack Klein

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 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top