View Single Post

   
  #5 (permalink)  
Old 01-16-2008, 08:02 PM
Vishwas Pai
 
Posts: n/a
Default Re: original user id

iam.techy@gmail.com wrote:
> Hi,
> I want to find out the original user id of any given process..
> Original user in the sense, if I had done su to user 'Y' from login
> shell of user 'X' , then all the processes run by 'Y' on su shell
> should report me that original user is 'X'. Well this was the basic
> requirement, and most imp. requirement..
>
> 2. To complicate it further, if 'X' starts a daemon, can I get 'X' as
> the original user from that daemon process ?
> 3. More than this if the new process or su (on Y from shell X) process
> does a sesid (), can we still get the user as X ??
>


You should be able to get real user id by calling
crgetruid(cred_t *). Struct ucred * is passed to most
filesystem based entry points by upper layer. You
can also use functions such as crgeteuid() for
getting effective user-id. These kernel APIs may
get in-lined while building the kernel - so you
may need to pass additional compile switches if
the resulting driver does not link properly.

I don't see these being exported as part of of DDR
- I think one can submit such requests here ..

http://h21007.www2.hp.com/dspp/Onlin...914,74,00.html
(http://tinyurl.com/kvgov)

--vishwas
Reply With Quote